Error when building

Monkey Targets Forums/Android/Error when building

Shane(Posted 2011) [#1]
Hi,

Im new to Monkey and am getting the following error when trying to build and run to Android.

TRANS Failed to execute 'adb start-server', return code=1
'adb' is not recognized as an internal or external command,
operable program or batch file.

Any ideas what i've done wrong?

Shane


therevills(Posted 2011) [#2]
Have you installed the Android SDK?


Shane(Posted 2011) [#3]
Yes have installed it.


therevills(Posted 2011) [#4]
Pointed your config.winnt.txt to the installed location?

ANT_PATH=
ANDROID_PATH=
JDK_PATH=


Shane(Posted 2011) [#5]
Yes. Any ideas?


Shane(Posted 2011) [#6]
This is where I am pointing to :

ANDROID_PATH="${PROGRAMFILES}\Android\
JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_21\"
ANT_PATH="${SYSTEMDRIVE}\apache-ant-1.8.2\"


skid(Posted 2011) [#7]
There's a quotes missing after \Android\ ?


therevills(Posted 2011) [#8]
On my machine at home the {PROGRAMFILES} and {SYSTEMDRIVE} doesnt seem to work right so I put in the full path:

ANDROID_PATH="C:\Program Files\Android\"


Shane(Posted 2011) [#9]
I checked the file the quote was there. Do I need a server running? What directory is the server located?


Shane(Posted 2011) [#10]
I tried changing to c:\program files etc and still no difference. It seems to find the directories otherwise 'ANDROID' will not appear as a build and run option.


therevills(Posted 2011) [#11]
Hmmmmm .... reboot?

Try this guide:
http://modmymobile.com/forums/3883156-post1.html


Aman(Posted 2011) [#12]
I don't think it's a problem with monkey.

Did you add the path of your android sdk tool to the Enviroment variables?
Did you run the SDK Manager and added a virtual device?

Open cmd and type adb. If it didn't get recognized, then it is not added to the enviroment variables path.

Stay in cmd and type:
cd C:\Program Files\Android\android-sdk\platform-tools
then try to run adb from their

If it didn't work, adb server is not working and you need to re install android sdk again.

adb is used to install the app into the virtual or an actual device.

Check your build folder. If you have an android folder, there is a couple of apk files inside android\bin. copy the signed one to your phone and install manually.


Shane(Posted 2011) [#13]
Hi Aman,

typing cmd did not work. But changing to the directory and typing adb start-server seemed to work. But still didnt work in build and run

I have installed a virtual device in sdk manager. How do I add the path of your android sdk tool to the Enviroment variables?

Shane


Shane(Posted 2011) [#14]
Okay I got the adb into environmental variables in windows. This part is working but now I have the following errors

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Buildfile: C:\MonkeyPro29\MonkeyPro29\bananas\Richard_Betson\TileImage\TileImage.build\android\build.xml
BUILD FAILED
C:\MonkeyPro29\MonkeyPro29\bananas\Richard_Betson\TileImage\TileImage.build\android\build.xml:49: taskdef class com.android.ant.SetupTask cannot be found
using the classloader AntClassLoader[]
Total time: 1 second
Buildfile: C:\MonkeyPro29\MonkeyPro29\bananas\Richard_Betson\TileImage\TileImage.build\android\build.xml
BUILD FAILED
C:\MonkeyPro29\MonkeyPro29\bananas\Richard_Betson\TileImage\TileImage.build\android\build.xml:49: taskdef class com.android.ant.SetupTask cannot be found
using the classloader AntClassLoader[]
Total time: 1 second


AdamRedwoods(Posted 2011) [#15]
You must set the path in the config.

I also recommending NOT installing in program files folder, but in the 'c:'. I had problems with Win7x64.

Also try:
ANDROID_PATH="${PROGRAMFILES}\Android\android-sdk"


therevills(Posted 2011) [#16]
Heres my config.winnt.txt paths:

ANT_PATH="E:\Programming\apache-ant-1.8.2"

JDK_PATH="C:\Program Files (x86)\Java\jdk1.6.0_19"

ANDROID_PATH="C:\Program Files (x86)\Android\android-sdk"


Also I didnt have to set the path in the Enviroment variables for the android sdk...


Shane(Posted 2011) [#17]
Okay seems to be building okay see below.

install:
[echo] Installing C:\MonkeyPro\MonkeyPro43\bananas\mak\bouncyaliens\bouncyaliens.build\android\bin\MonkeyGame-debug.apk onto default emulator or device...
[exec] error: device not found
BUILD FAILED
C:\Program Files\Android\android-sdk\tools\ant\main_rules.xml:653: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\main_rules.xml:271: exec returned: 1
Total time: 15 seconds

But no emulator is found, I have set up virtual emulators in the sdk. How do I get them to load?


AdamRedwoods(Posted 2011) [#18]
Make sure the emulator is running, ie, the window will be open.


therevills(Posted 2011) [#19]
As Adam has said start the emulator... or plug in your phone :)

So what "fixed" the building?


Shane(Posted 2011) [#20]
Thanks for everybody's help. I reinstalled a few packages and put the adb in environmental settings.

One more thing now - it doesn't seem to load on to the emulator. Get the following error
install:
[echo] Installing C:\MonkeyPro\MonkeyPro43\bananas\hitoro\delta\delta.build\android\bin\MonkeyGame-debug.apk onto default emulator or device...
[exec] Error: Could not access the Package Manager. Is the system running?
[exec] 171 KB/s (41147 bytes in 0.234s)


Shane(Posted 2011) [#21]
I should mention the emulator was running - but when it started it did have an error 'error loading preferences'


AdamRedwoods(Posted 2011) [#22]
try running the emulator from the command line.
also make sure you added an emulator profile with the SDKmanager.
also try standing on one foot with a frying pan on your head.


Shane(Posted 2011) [#23]
I was running from the command line and yes profiles were with sdk manager. The app just didn't want to run in the emulator for some reason.

I'll give the one foot and frying pan a go..hahaha

Cheers


Aman(Posted 2011) [#24]
Usually this is a result of the emulator running slowly. Is it responding?
Try restarting or refreshing the emulator.


therevills(Posted 2011) [#25]
I hard it impossible to use the emulator... it is soooo slow!


Aman(Posted 2011) [#26]
therevills, it is not just slow. it is a piece of crap. Google does a great job on developing android and providing documents but their SDK is a joke.


Uncle(Posted 2011) [#27]
Same here. The emulator is pretty awful. Compiling to the actual device is much faster.

To get the emulator working I had to run the android.bat batch file with administrator rights and then launch the emulator from there. I also gave the emulator.ext admin rights too. Not sure if that helps you.


Michael(Posted 2013) [#28]
I had the exact same problem.

therevills said

> So what "fixed" the building?

For me, it was adding "sdk" to the ANDROID_PATH (originally I thought it was just the parent, but sdk is needed to be postpended. The following worked for me
ANT_PATH="c:~monkeyapache-ant-1.8.4"
JDK_PATH="C:Program Files (x86)Javajdk1.6.0_27"
ANDROID_PATH="c:~monkeyadt-bundle-windows-x86_64sdk"

I also didn't need "C:\~monkey\adt-bundle-windows-x86_64\sdk\platform-tools" added to the path for the build to work. I also needed to plug in my device for it to auto-install (and avoid another error).

I think the doc for "The Android target" should be updated to be more clear about the above points to save some new user frustration.