Android Hello World Example
Monkey Targets Forums/Android/Android Hello World Example
| ||
Hi Crazy Kids Just Bought Monkey Pro ...So Excited i Could Burst i have Very Nooob Question Sorry using Monk there is no Build option for Android i have the Android SDK E.T.C as i have been coding for Android using Eclipse for years...i have also setup the...Config.winnt pointing to Ant..Java and Android but still no build option for Android...so i was wondering if somebody had some Android Setup Code Please Help lee SaveTheFrogs |
| ||
Sounds like youve got everything set up so it should work... Could you post your config file and also your file structure? |
| ||
Update Got Android target to show up ...i had a SPACE in the Path to my Android SDK in the config.winnt..e.g ANDROID_PATH="C:\Program Files\Android\android-sdk_r05-windows\android-sdk-windows" should have been ANDROID_PATH="${PROGRAMFILES}\Android\android-sdk_r05-windows\android-sdk- windows" Some Android Hello world code would Still be a Massive Help Thanks lee SaveTheFrogs |
| ||
Any Monkey/Mojo code will work on any of the targets, check out the bananas folder for examples, but here is the skeleton framework for mojo:Strict Import mojo Function Main:Int() New Game() Return 0 End Class Game Extends App Field x:Float, y:Float Method OnCreate:Int() x = 100 y = 100 SetUpdateRate(60) Return 0 End Method OnUpdate:Int() x+=1 y+=1 If x > DeviceWidth() Then x = 0 If y > DeviceHeight() Then y = 0 Return 0 End Method OnRender:Int() Cls DrawText("Hello World", x, y) Return 0 End End |
| ||
Thanks therevills it was a mistake in config.winnt this is Quite helpfull https://wiebo.wordpress.com/2011/05/08/how-to-monkey-and-android-development-setup/ still no code though...i don't Know Which example from the bananas to use getting compile errors TRANS FAILED: Error updating target project - can't find block end tag 'CONFIG'. is the Android Example banana hehe lee |
| ||
Thanks therevills i feel i am getting a little closer getting this error now Translating game1 "C:/Program Files/Blitz Monkeey/MonkeyPro56/bin/trans_winnt" -target=android -run "C:/Program Files/Blitz Monkeey/MonkeyPro56/mystuff/game1.monkey" TRANS monkey compiler V1.32 Parsing... Semanting... Translating... Building... TRANS FAILED: Error updating target project - can't find block end tag 'CONFIG'. Process Complete |
| ||
Move your game1.monkey project into a folder structure without any spaces. |
| ||
This is how I sort my directories: c:/monkey/MonkeyPro99 c:/dev/monkey/gameprojectname |
| ||
Hi Guys Thanks soo much for all you help...Still having problems building for Android though i am still getting this error: Translating bouncyaliens C:/aaamonkeey/MonkeyPro56/bin/trans_winnt -target=android -run C:/aaamonkeey/MonkeyPro56/bananas/mak/bouncyaliens/bouncyaliens.monkey TRANS monkey compiler V1.32 Parsing... Semanting... Translating... Building... * daemon not running. starting it now on port 5037 * * daemon started successfully * 'ant' is not recognized as an internal or external command, operable program or batch file. TRANS FAILED: Android build failed. Process Complete i am using Windows7 my config.winnt looks like this '-------------------- 'HTML player path. ' 'Must be set for HTML5 target support. ' 'for opening .html files... ' HTML_PLAYER="${TRANSDIR}\mserver_winnt.exe" '-------------------- '-------------------- '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 'C:\aaamonkeey\apache-ant-1.8.3 ANT_PATH="C:\aaamonkeey\apache-ant-1.8.3" 'ANT_PATH="${SYSTEMDRIVE}\ant" '-------------------- '-------------------- 'MinGW path. ' 'Must be set to a valid dir for STDCPP target support. ' 'MinGW is currently available here: ' http://tdm-gcc.tdragon.net/download ' MINGW_PATH="${SYSTEMDRIVE}\MinGW32" MINGW_PATH="${SYSTEMDRIVE}\MinGW" '-------------------- '-------------------- '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="C:\Java\jdk1.7.0_02" 'JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_23" 'JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_21" 'JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_19" '-------------------- '-------------------- '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 'C:\androidsdk1 ANDROID_PATH="C:\android-sdk-windows" 'ANDROID_PATH="C:\android-sdk-windows\platform-tools" '-------------------- '-------------------- 'Flex SDK and flash player path. ' 'FLEX_PATH Must be set for FLASH target support. ' 'Either HTML_PLAYER or FLASH_PLAYER must be set for FLASH target support. ' 'The Flex SDK is currently available here: ' http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK ' FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.6" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.5" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.1.0.16076" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.1" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.0.0.14159" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.0" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk" ' 'for opening .swf files...monkey will use HTML_PLAYER if this is not set. 'FLASH_PLAYER="${SYSTEMDRIVE}\flex_sdk_4.0\flashplayer_10_sa_debug.exe" ' '-------------------- '-------------------- 'MSBUILD path. ' 'Must be set for XNA and GLFW target support. ' 'Visual C++ 2010 Express is required for GLFW target support and is currently available here: ' http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express ' 'Visual C# 2010 Express and XNA 4.0 are requred for XNA target support and are currently available here: ' http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express ' http://www.microsoft.com/download/en/details.aspx?id=23714 ' MSBUILD_PATH="${WINDIR}\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" '-------------------- my Environmental Variables for Path are: C:\aaamonkeey\apache-ant-1.8.3\bin; C:\Java\jdk1.7.0_02\bin; C:\android-sdk-windows\platform-tools; C:\android-sdk-windows please Please Help this driving me mad Many Thanks lee |
| ||
I had a few problems with environment variables. These are what I have for ant in PATH: d:\ant\apache-ant-1.8.3\bin\ant.bat; d:\ant\apache-ant-1.8.3\bin; Hope that helps! |
| ||
Hi Guy's thanks for all your help finally got it working i had lost ant.bat when copying and pasting...WooHoo lee |
| ||
Hi guys, I'm having a familiar problem, I did everything that LeeTheGee1 did, but I have a new problem. It says 'adb' is not recognized? I have no clue what I did wrong. This is the error messege: =================================================================== "C:/MonkeyPro63b/bin/trans_winnt" -target=android -config=Debug "C:/Users/Richard/Projects/Monkey/mami/sweets.monkey" TRANS monkey compiler V1.39 Parsing... Semanting... Translating... Building... 'adb' is not recognized as an internal or external command, operable program or batch file. TRANS FAILED: TRANS Failed to execute 'adb start-server', return code=1 Done. =================================================== And this is my config.winnt.txt ---------- '-------------------- 'HTML player path. ' 'Must be set for HTML5 target support. ' 'for opening .html files... ' HTML_PLAYER="${TRANSDIR}\mserver_winnt.exe" '-------------------- '-------------------- '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="c:\TargetSDK\apache-ant-1.8.4" ANT_PATH="c:\TargetSDK\apache-ant-1.8.4\bin" ANT_PATH="c:\TargetSDK\apache-ant-1.8.4\bin\ant.bat" 'ANT_PATH="${SYSTEMDRIVE}\apache-ant-1.8.4" ANT_PATH="${SYSTEMDRIVE}\ant" '-------------------- '-------------------- 'MinGW path. ' 'Must be set to a valid dir for STDCPP target support. ' 'MinGW is currently available here: ' http://tdm-gcc.tdragon.net/download ' MINGW_PATH="${SYSTEMDRIVE}\MinGW32" MINGW_PATH="${SYSTEMDRIVE}\MinGW" '-------------------- '-------------------- '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="c:\TargetSDK\Java\jdk1.7.0_13" 'JDK_PATH="${PROGRAMFILES}\Java\jdk1.7.0_13" JDK_PATH="${PROGRAMFILES}\Java\jdk1.7.0_02" JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_23" JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_21" JDK_PATH="${PROGRAMFILES}\Java\jdk1.6.0_19" '-------------------- '-------------------- '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="c:\TargetSDK\adt-bundle-windows-x86" ANDROID_PATH="c:\TargetSDK\adt-bundle-windows-x86\sdk\platform-tools" 'ANDROID_PATH="${SYSTEMDRIVE}\android-sdk-windows" '-------------------- '-------------------- 'Flex SDK and flash player path. ' 'FLEX_PATH Must be set for FLASH target support. ' 'Either HTML_PLAYER or FLASH_PLAYER must be set for FLASH target support. ' 'The Flex SDK is currently available here: ' http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK ' FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.6" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.5" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.1.0.16076" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.1" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.0.0.14159" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4.0" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk_4" FLEX_PATH="${SYSTEMDRIVE}\flex_sdk" ' 'for opening .swf files...monkey will use HTML_PLAYER if this is not set. 'FLASH_PLAYER="${SYSTEMDRIVE}\flex_sdk_4.0\flashplayer_10_sa_debug.exe" ' '-------------------- '-------------------- 'Play Station Suite SDK path. ' 'PSS_PATH must be set for PSS target support. ' 'Note: This will soon be replaced by the Play Station Mobile target - use that instead! ' PSS_PATH="${PROGRAMFILES}\SCE\Pss" '-------------------- 'Play Station Mobile SDK path. ' 'PSM_PATH must be set for PSM target support. ' 'Note: This will soon replace the Play Station Suite target - use this instead!!!!! ' PSM_PATH="${PROGRAMFILES}\SCE\PSM" '-------------------- 'MSBUILD path. ' 'Must be set for XNA and GLFW target support. ' 'Visual C++ 2010 Express is required for GLFW target support and is currently available here: ' http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express ' 'Visual C# 2010 Express and XNA 4.0 are requred for XNA target support and are currently available here: ' http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express ' http://www.microsoft.com/download/en/details.aspx?id=23714 ' MSBUILD_PATH="${WINDIR}\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" '-------------------- ============================ I have everything in c:\TargetSDK I don't know what I did wrong. If someone can help me please? I will really appreciate it guys. Thanks in advance. |
| ||
Just in case, I'm running WindowsXP SP3. I download Java Devp Kit Windows x86 88.74 MB jdk-7u13-windows-i586.exe Just in case someone see this post. Thanks |
| ||
pathing issue usually. check: ANT_PATH JDK_PATH ANDROID_PATH make sure adb is in ANDROID_PATH/platform-tools/adb.exe mine is: ANDROID_PATH="${PROGRAMFILES}\Android\android-sdk" and remember no spaces in folder names. |
| ||
Thank you AdamRedwoods, but yeah I check all my folders for spaces. And yes, adb.exe is in the platform-tools folder. So you have android SDK in your (Program Files folder?), I will try to add that path that you have to try it out. I have the adroid sdk in the c:\ like this: c:\TargetSDK\adt-bundle-windows-x86\sdk\platform-tools At least I made flash work :) but I need android for my projects :S |
| ||
In some post, I heard someone saying that if install a android emulator will allow you to run it, im going to try installing an android emulator to see if it work. |
| ||
Did anyone have a solution for getting the Android platform to compile? I have this error message (here's my build log to possibly help decipher the issue :) Thanks Mike "C:/Program Files/MonkeyCoderPro/bin/transcc_winnt" -target=Android_Game -config=Release "C:/Program Files/MonkeyCoderPro/bananas/HelloWorld/HelloWorld.monkey" TRANS monkey compiler V1.56 Parsing... Semanting... Translating... Building... Buildfile: C:\Program Files\MonkeyCoderPro\bananas\HelloWorld\HelloWorld.build\android\build.xml -check-env: [checkenv] Android SDK Tools Revision 22.2.1 [checkenv] Installed at C:\TargetSDK\android\sdk -setup: [echo] Project Name: MonkeyGame [gettype] Project Type: Application -pre-clean: clean: [getlibpath] Library dependencies: [getlibpath] No Libraries [subant] No sub-builds to iterate on BUILD SUCCESSFUL Total time: 0 seconds Buildfile: C:\Program Files\MonkeyCoderPro\bananas\HelloWorld\HelloWorld.build\android\build.xml -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 22.2.1 [checkenv] Installed at C:\TargetSDK\android\sdk -setup: [echo] Project Name: MonkeyGame [gettype] Project Type: Application -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] Using latest Build Tools: 18.1.0 [echo] Resolving Build Target for MonkeyGame... BUILD FAILED C:\TargetSDK\android\sdk\tools\ant\build.xml:542: Unable to resolve project target 'android-13' Total time: 0 seconds TRANS FAILED: Android build failed. Done. |
| ||
"Launch up the SDK manager and make sure you have downloaded Android 3.2 (API 13)." http://www.monkeycoder.co.nz/Community/posts.php?topic=4231#45342 |
| ||
Thanks Volker :) All done and working perfectly! thanks! Mike |
| ||
You also should get one of the latest Monkey released. Compiler v1.32 sounds you are using v63, or? |