Cannot build to Android

Monkey Targets Forums/Android/Cannot build to Android

andrew_r(Posted 2012) [#1]
I am currently working through the book Monkey Game Development and am on Chapter 5, which was creating my first App for Android. I am at a complete loss on how to compile it into android. I Installed java jdk, Ant 1.8.2, and the android SDK. It gives me the option to build to Android, but when I try I get the error

"C:/Users/Josh/Documents/Monkey/chainreaction/ftFunctions.monkey<4> : Error : File 'C:/Users/Josh/Documents/Monkey/chainreaction/native/fantomengine.android.java' not found.
Abnormal program termination. Exit code: -1"

The app is called chainreaction.monkey, and uses fantomEngine.monkey and ftFunctions.monkey to run. Any help would be appreciated.


therevills(Posted 2012) [#2]
Does it work on another of the other targets?

Also check in your module/fantomEngine/native folder, can you see fantomengine.android.java?


andrew_r(Posted 2012) [#3]
It works for html5 and Flash, which are the only two I've used yet. And I don't have a native folder, let alone a fantomengine.android.java, I tried just taking the monkey code for fantomEngine and renaming it to fantomengine.android.java in a new folder called native, and it passed the error (Onto a new one of course), but I somehow doubt I'm supposed to call something made to be .monkey into .android.java .

In case I somehow stumbled into doing it correctly, this is the new error I'm getting.

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

BUILD FAILED
C:\Program Files\android\android-sdk\tools\ant\build.xml:517: Unable to resolve project target 'android-13'

Total time: 0 seconds
TRANS FAILED: Android build failed.
Abnormal program termination. Exit code: -1
C:\Tools\Monkey\bin\trans_winnt.exe -build -config=debug -target=android "C:\Users\Josh\Documents\Monkey\chainreaction\chainreaction.monkey"
TRANS monkey compiler V1.37
Parsing...
C:/Users/Josh/Documents/Monkey/chainreaction/ftFunctions.monkey<4> : Error : File 'C:/Users/Josh/Documents/Monkey/chainreaction/native/fantomengine.android.java' not found.
Abnormal program termination. Exit code: -1"


therevills(Posted 2012) [#4]
Firstly, I'd suggest you redownload fantomEngine:

http://code.google.com/p/fantomengine/downloads/detail?name=fantomEngine_V142.zip&can=2&q=

In this zip I can see the fantomengine.android.java in the fantomEngine/native folder.

Second, the "Unable to resolve project target 'android-13'" sounds like you havent set up Android correctly yet. Check here:
http://sagistech.blogspot.com.au/2010/05/android-sdk-error-unable-to-resolve.html

I would try to fix your Android error first, try running one of the examples (eg bouncyaliens) on your device, then get fantom working.


andrew_r(Posted 2012) [#5]
Well, I got fantom working, unfortunately I cant seem to get the android problem figured out. I used the SDK Manager to install 4.1 before I even posted here, yet the error is saying I'm missing 3.1, and it won't let me download previous versions.

'--------------------
'Ant build tool path
'
'Must be set to a valid dir for ANDROID target support
'
'Ant is currently available here:
' http://ant.apache.org/bindownload.cgi
'
'ANT_PATH="${SYSTEMDRIVE}\apache-ant-1.8.2"
ANT_PATH="${SYSTEMDRIVE}\Tools\Ant\ant_1.8"
'--------------------

'--------------------
'Java dev kit path
'
'Must be set to a valid dir for ANDROID and FLASH target support
'
'Make sure to install the 32 bit JDK, even on 64 bit Windows!
'
'The Java JDK is currently available here:
' http://www.oracle.com/technetwork/java/javase/downloads/index.html
'
JDK_PATH="${PROGRAMFILES}\Java\jdk1.7.0_05"
'--------------------

'--------------------
'Android SDK and tool paths.
'
'Must be set to a valid for for ANDROID target support
'
'The Android SDK is currently available here:
' http://developer.android.com/sdk/index.html
'
ANDROID_PATH="${PROGRAMFILES}\android\android-sdk"



Just in case I'm missing something obvious there


Sub_Zero(Posted 2012) [#6]
I had the same problem.... You need to download Android 3.2 (Api 13) using the android SDK manager....

Then create a AVD device using api 13 with the android AVD manager...

Now it should work ok ;)