How to build for Android
Monkey Targets Forums/Android/How to build for Android
| ||
Hi all, I try to build a simple app for Android under Windows. I installed the JDK, the Android SDK and the Apache Ant 1.8.2 Pathes are set correctly in the trans config and everything works fine but the Apache Ant part, where I get the following error: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.0 I'm a bit confused about that because I installed 1.8.2 and set the path correctly: '-------------------- 'Ant build tool path ' 'Must be set to a valid dir for ANDROID target support ' ANT_PATH="D:\Programme\apache-ant-1.8.2" |
| ||
Can you post your 'config.winnt.txt' in [codebox], sometimes an improper jdk_Path could be the problem. Make sure if your on Win 7 that you have the 32bit version of jdk installed. L8r, |
| ||
Richard, I have the 32 bit version of jdk installed and actually I get a Java build ready (helloworld.build/android/com/monkey/MonkeyGame.java), only the final step doesn't work. My config looks like: '-------------------- 'Ant build tool path ' 'Must be set to a valid dir for ANDROID target support ' ANT_PATH="D:\Programme\apache-ant-1.8.2" '-------------------- '-------------------- 'MinGW path. ' 'Must be set to a valid dir for STDCPP target support. ' MINGW_PATH="D:\Programme\MinGW" '-------------------- '-------------------- 'Java dev kit path ' 'Must be set to a valid dir for ANDROID and FLASH target support ' JDK_PATH="D:\Programme\Java\jdk1.6.0_24" '-------------------- '-------------------- 'Android SDK and tool paths. ' 'Must be set to a valid for for ANDROID target support ' ANDROID_PATH="D:\Programme\Android\android-sdk" '-------------------- The output looks like: Translating helloworld D:/Programme/MonkeyPro/bin/trans_winnt -target=android -run D:/Projekte/monkeytest/helloworld.monkey TRANS monkey compiler V1.01 Parsing... Semanting... Translating... Building... * daemon not running. starting it now on port 5037 * * daemon started successfully * Buildfile: build.xml BUILD FAILED D:\Projekte\monkeytest\helloworld.build\android\build.xml:65: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.0 Total time: 0 seconds Buildfile: build.xml BUILD FAILED D:\Projekte\monkeytest\helloworld.build\android\build.xml:65: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.0 Total time: 0 seconds Process complete Thank you! |
| ||
Did you create a virtual Android device in the SDK first? IIRC I got similar issues until I created the device, and started it |
| ||
Uhm... no. I just installed the JDK first, then the Android SDK which download a lot of more stuff. |
| ||
Ok, I've created a virtual device (Android 2.2) and it still doesn't work. The SDK manager shows that the device is working though... Must be some problem with the final step. Don't know yet. Does it work for you? |
| ||
I'm not sure that will help as the error seems to be with Ant and would be a different kind of error (but you should be running the android v-device). @Xaron I have noticed your using newer versions of Ant and jdk then I am so I am going to update to check them out. But you might try adding this to your system environment variables, 'Path' C:\Program Files (x86)\Android\android-sdk-windows\platform-tools or in your case it might be (where ever it's located): D:\Programme\Android\android-sdk-windows\platform-tools I recall for some reason I needed it on Win 7. L8r, |
| ||
Thanks Richard. I will try that. Setting the path itself for android didn't change anything. Probably there is some older ANT version somewhere which is chosen due to whatever reasons. I will try it on another computer as well... edit: I think I've found the problem. I have an older cygwin install where Apache Ant 1.7.0 is installed. Will check that out, thanks for your help! :) |
| ||
I didn't need to add anything to the windows path (on Win7 x64) to compile for Android myself... |
| ||
OK, Looks like you do not need the 'path' variable as I removed it and all went well. Must have been a hangover from previous versions of Monkey. I still do not see why it's not working but here is an excerpt of my 'config.winnt.txt'. ANDROID_PATH="C:\Program Files (x86)\Android\android-sdk-windows" ANT_PATH="C:\Ant" JDK_PATH="C:\Program Files (x86)\Java\jdk1.6.0_23" It's a little different as my Android sdk path (ANDROID_PATH) is "android-sdk-windows" at the 'end' of the path and yours is missing the "-windows" part. L8r, |
| ||
Also, I think you need to have the simulator running before you compile. |
| ||
Haven't tried building an app for Android through Monkey yet, but try checking your ANT_HOME environment variable. |
| ||
Thanks FlameDuck, that did the trick! :) There was no such environment variable but after creating it everything works fine so far. |
| ||
.. nvm did not have the emulator started. |
| ||
I'm getting the following on Mac OS X:TRANS monkey compiler V1.02 SDK for target: android does not appear to be correctly installedAndroid SDK is installed Target appears in trans_macos Virtual Device is configured Emulator is running Any ideas? |
| ||
My config.macos.txt was the culprit, I'd replaced it with an unedited copy at some point... I then got TRANS Failed to execute 'adb start-server', return code=65280 and solved it by putting the path to platform-tools (the new location of adb) onto my shell PATH variable |
| ||
Hi folks, just installed the complete SDK on OSX but get an error in main_rules.xml in the last line i had attached on compile for every example: <target name="install" depends="debug" description="Installs/reinstalls the debug package onto a running emulator or device. If the application was previously installed, the signatures must match." > <install-helper /> |
| ||
Ok got it running. |
| ||
hello, when i build i get: TRANS monkey compiler V1.05 Parsing... Semanting... Translating... Building... * daemon not running. starting it now on port 5037 * * daemon started successfully * Buildfile: C:\Users\xzess\Documents\xzess app\xzessapp.build\android\build.xml [setup] Android SDK Tools Revision 10 [setup] Project Target: Android 2.1-update1 [setup] API level: 7 [setup] [setup] ------------------ [setup] Resolving library dependencies: [setup] No library dependencies. [setup] [setup] ------------------ [setup] [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. [setup] [setup] Importing rules file: tools\ant\main_rules.xml clean: [delete] Deleting directory C:\Users\xzess\Documents\xzess app\xzessapp.build\android\bin [delete] Deleting directory C:\Users\xzess\Documents\xzess app\xzessapp.build\android\gen BUILD SUCCESSFUL Total time: 3 seconds Buildfile: C:\Users\xzess\Documents\xzess app\xzessapp.build\android\build.xml [setup] Android SDK Tools Revision 10 [setup] Project Target: Android 2.1-update1 [setup] API level: 7 [setup] [setup] ------------------ [setup] Resolving library dependencies: [setup] No library dependencies. [setup] [setup] ------------------ [setup] [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. [setup] [setup] Importing rules file: tools\ant\main_rules.xml -debug-obfuscation-check: -set-debug-mode: -compile-tested-if-test: -pre-build: -dirs: [echo] Creating output directories if needed... [mkdir] Created dir: C:\Users\xzess\Documents\xzess app\xzessapp.build\android\bin [mkdir] Created dir: C:\Users\xzess\Documents\xzess app\xzessapp.build\android\gen [mkdir] Created dir: C:\Users\xzess\Documents\xzess app\xzessapp.build\android\bin\classes -aidl: [echo] Compiling aidl files into Java classes... -renderscript: [echo] Compiling RenderScript files into Java classes and RenderScript bytecode... -resource-src: [echo] Generating R.java / Manifest.java from the resources... -pre-compile: compile: [javac] C:\Program Files (x86)\Android\android-sdk\tools\ant\main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 2 source files to C:\Users\xzess\Documents\xzess app\xzessapp.build\android\bin\classes [javac] Note: C:\Users\xzess\Documents\xzess app\xzessapp.build\android\src\com\xzess\MonkeyGame.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. -post-compile: -obfuscate: -dex: [echo] Converting compiled files and external libraries into C:\Users\xzess\Documents\xzess app\xzessapp.build\android\bin\classes.dex... [apply] "=C:\Users\xzess\Documents\xzess" kann syntaktisch an dieser Stelle nicht verarbeitet werden. BUILD FAILED C:\Program Files (x86)\Android\android-sdk\tools\ant\main_rules.xml:472: The following error occurred while executing this line: C:\Program Files (x86)\Android\android-sdk\tools\ant\main_rules.xml:203: apply returned: 255 Total time: 3 seconds Android build failed. Process Complete any help on this? |
| ||
It's the same problem I had when I used spaces between characters in path and filenames. |
| ||
Yep, Playniax is correct. Move you app to a different location: From C:\Users\xzess\Documents\xzess app\ to C:\Users\xzess\Documents\xzessapp\ |
| ||
that was it! thanks, working great :) really funny to play with |