Help compiling for Android

Monkey Targets Forums/Android/Help compiling for Android

Tibit(Posted 2012) [#1]
I get this:

-build-setup:
[echo] Resolving Build Target for MonkeyGame...

BUILD FAILED
C:android-sdk-windowstoolsantbuild.xml:539: Unable to resolve project target 'android-13'

Total time: 0 seconds
TRANS FAILED: Android build failed.
Abnormal program termination. Exit code: -1

Any ideas on what to try?


Tibit(Posted 2012) [#2]
More info: I'm testing this on Windows8. Using v66 of Monkey.


therevills(Posted 2012) [#3]
Sounds like you haven't either setup your config.winnt.txt to point to the Android sdk or you haven't installed/downloaded Android 13.


Tibit(Posted 2012) [#4]
The android sdk comes in a zip, in that folder there is two folders, "sdk" and "eclipse" and a SDK Manager.exe. And I in monkey linked to the sdk folder like this:

ANDROID_PATH="${SYSTEMDRIVE}android-sdk-windowssdk"

[Update]
Now that I got home I re-installed everything for the Android target here, on Windows 7. I get the same error mysteriously enough. I'm using the latest versions of everything.

If I do not have the sdk path, then I don't even get this error. Note that at: C:android-sdk-windowssdktoolsantbuild.xml there actually is an xml.

[echo] Resolving Build Target for MonkeyGame...

BUILD FAILED
C:android-sdk-windowssdktoolsantbuild.xml:541: Unable to resolve project target 'android-13'

I think everything is correctly linked, how can I check?


therevills(Posted 2012) [#5]
Launch up the SDK manager and make sure you have downloaded Android 3.2 (API 13).


Tibit(Posted 2012) [#6]
Hmm... ok I was using version 17. Great! It is moving forward.

Now I get this error instead.



Not really sure what it wants me to do.


Tibit(Posted 2012) [#7]
I tested with Monkey67b and that worked! As far as saying Installing on default emulator or device. However neither the emulator or device opens.


Tibit(Posted 2012) [#8]
Update again.

So I used a apk-installer app and installed the apk file manually and that worked. Monkey now running on my Nexus 10!

If anyone has any ideas on how to get the "auto install apk" or emulator to work, please share!


therevills(Posted 2012) [#9]
Have you enabled developer mode on your nexus and installed the driver on your PC?


Tibit(Posted 2012) [#10]
Good suggestions, but yes I think I have covered those. My device says USB debugging connected. However it don't respond to that "install" command. I have the drivers and I see the device in windows and can access the SD.


therevills(Posted 2012) [#11]
Ok.... how is your Nexus connecting to your PC? It needs to be connecting as a camera not a media device.


Tibit(Posted 2013) [#12]
Yes, I have tested both, but yes media device it is. Probably because it is so new there is some driver thing going on maybe? Can't find anyone else with a similar problem tough!


chimaera(Posted 2013) [#13]
I have just completed setting up my new Nexus 7 to work with Monkey and Jungle IDE, and I believe that I can answer your question.

1) Check out this link to learn how to setup your nexus 7 so it connects as a camera (PTP). http://zacktutorials.blogspot.se/2012/08/nexus7-android-development.html

2) You also have to turn on "USB debugging". You do this in the Developers options which Google as hidden. The link below will tell you how to reach it.
http://www.androidpolice.com/2012/11/13/reminder-tip-developer-options-are-hidden-in-android-4-2-heres-how-to-find-them/

3) Windows will now say something about your nexus driver being a bit messed up. Follow the instructions in the section called "Windows7 USB Driver installation for nexus7" available in the link from section 1 above.

You should now be able to "auto install and run" your apps on the Nexus 7.

Hope it helps!


jwl(Posted 2013) [#14]
Still getting errors trying to compile for android. Tried it on the latest version 66c. The code compiles on all the other targets. I'm able to compile code on the Android/eclipse platform. No problems with the Android emulator. Android emulator running when compiling from Ted. Ted sees the SDK. Not sure what else to try??? Is there a script or something that a newbie can run that will configure Monkey with Android????? That will surely be appreciated by some here....


"/Applications/- - - MonkeyPro67c/bin/transcc_macos" -target=Android_Game -config=Debug "/shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.MONKEY"
Parsing...
Semanting...
Translating...
Building...
Buildfile: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/build.xml

-check-env:
[checkenv] Android SDK Tools Revision 21.0.1
[checkenv] Installed at /adt-bundle-mac-x86_64/sdk

-setup:
[echo] Project Name: MonkeyGame
[gettype] Project Type: Application

-pre-clean:

clean:
[delete] Deleting directory /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/bin
[delete] Deleting directory /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
[subant] No sub-builds to iterate on

BUILD SUCCESSFUL
Total time: 1 second
Buildfile: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 21.0.1
[checkenv] Installed at /adt-bundle-mac-x86_64/sdk

-setup:
[echo] Project Name: MonkeyGame
[gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-build-setup:
[echo] Resolving Build Target for MonkeyGame...
[gettarget] Project Target: Android 3.2
[gettarget] API level: 13
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/bin
[mkdir] Created dir: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/bin/res
[mkdir] Created dir: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/gen
[mkdir] Created dir: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/bin/classes
[mkdir] Created dir: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/bin/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for MonkeyGame...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on

-pre-build:

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 3 source files to /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/bin/classes
[javac] /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/src/com/monkey/MonkeyGame.java:69: cannot find symbol
[javac] symbol : variable activity
[javac] location: class com.monkey.MonkeyGame
[javac] return MonkeyGame.activity.getAssets();
[javac] ^
[javac] /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/src/com/monkey/MonkeyGame.java:142: cannot find symbol
[javac] symbol : variable activity
[javac] location: class com.monkey.MonkeyGame
[javac] File f=MonkeyGame.activity.getFilesDir();
[javac] ^
[javac] /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/src/com/monkey/MonkeyGame.java:145: cannot find symbol
[javac] symbol : variable activity
[javac] location: class com.monkey.MonkeyGame
[javac] File f=MonkeyGame.activity.getExternalFilesDir(null);
[javac] ^
[javac] /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/src/com/monkey/MonkeyGame.java:1525: cannot find symbol
[javac] symbol : variable gameView
[javac] location: class com.monkey.R.id
[javac] _view=(GameView)findViewById( R.id.gameView );
[javac] ^
[javac] Note: /shared/- - - monkey programming/- - - PROJECTS/FUNC SUM/_FUNCTSUM.build/android/src/com/monkey/MonkeyGame.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.

BUILD FAILED
/adt-bundle-mac-x86_64/sdk/tools/ant/build.xml:710: The following error occurred while executing this line:
/adt-bundle-mac-x86_64/sdk/tools/ant/build.xml:723: Compile failed; see the compiler error output for details.

Total time: 3 seconds
[javac] 4 errors
TRANS FAILED: Android build failed.
Done.


jwl(Posted 2013) [#15]
So has anyone figured out a fool newbie proof way to get
Monkey working with Android on a MAC? It works just fine with all the other platforms except Android in my case. I'm able to compile on Eclipse. The emulator albeit slow works. Ted sees the SDK.... But it still errors out....


Any ideas out there? How about a setup script that checks/configures Monkey with Android?

Thanks


J


Soap(Posted 2013) [#16]
With 66b I'm getting

    [javac] bad class file: C:\monkey\MonkeyPro66b\New folder\tset.build\android\src\com\monkey\MonkeyGame.java
    [javac] file does not contain class com.monkey.MonkeyGame
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac] 		return MonkeyGame.activity.getAssets();
    [javac] 		       ^
    [javac] 19 errors

BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:705: The following error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:718: Compile failed; see the compiler error output for details.

Total time: 2 seconds
TRANS FAILED: Android build failed.
Done.

Also with doing a simple hello world.

But doing what this post suggests does compile: http://www.monkeycoder.co.nz/Community/post.php?topic=4301&post=46251