Simple test program crashes in emulator
Monkey Targets Forums/Android/Simple test program crashes in emulator
| ||
With the following test program :Import mojo.app Import mojo.graphics Class MyApp Extends App Method OnCreate() Return 0 End Method OnLoading() Return 0 End Method OnRender() DrawText "Hello World!",0,0 Return 0 End Method OnResume() Return 0 End Method OnSuspend() Return 0 End ' Process everything Method OnUpdate() Return 0 End End Function Main() New MyApp End whilst it works okay on Windows & HTML 5 and what not, in the Android 4.2.2 emulator, it starts (screen goes black and then immediately exits). |
| ||
Just to be sure, do you use the latest Monkey (70g) or the experimental one? |
| ||
In your OnCreate method add : SetUpdateRate(60) |
| ||
I'm using V69 SetUpdateRate(60) Alas, that didn't help I have also tried 70(g) with the same results unfortunately. I have also tried in Genymotion too, but with the same results - will need to get the logs... |
| ||
Try adding "Cls" in the OnRender method and just "import mojo", along with SetUpdateRate as Amon as stated. And since you are not using Strict you can remove the return statements. |
| ||
did ever run any monkey code on this android emulator? Did you test the code on a real device? What about this code: Strict Import mojo Class Game Extends App Method OnCreate%() SetUpdateRate 15 Return 0 End Method OnUpdate%() If KeyHit(KEY_ESCAPE) Then Error "" Return 0 End Method OnRender%() Cls Return 0 End End Function Main%() New Game Return 0 End |
| ||
I've reverted to :Strict Import mojo.app ' Import mojo.graphics Class MyApp Extends App Method OnCreate%() SetUpdateRate(15) Return 0 End Method OnLoading%() Return 0 End Method OnRender%() 'Cls(0,0,0) 'DrawText("Hello World!",0,0) Return 0 End Method OnResume%() Return 0 End Method OnSuspend%() Return 0 End ' Process everything Method OnUpdate%() Return 0 End End Function Main%() New MyApp Return 0 End But the program starts and ends instantly. I cant try on a real device until I get my tablet next week... |
| ||
Just import mojo, not mojo.app, also you have the cls commented out... |
| ||
I just do;Import mojo Import monkey I don't worry about importing stuff I wont be using. |
| ||
Alas, this still isn't working :Strict Import mojo Import monkey Class MyApp Extends App Method OnCreate%() SetUpdateRate(15) Return 0 End Method OnLoading%() Return 0 End Method OnRender%() Cls(0,0,0) DrawText("Hello World!",0,0) Return 0 End Method OnResume%() Return 0 End Method OnSuspend%() Return 0 End ' Process everything Method OnUpdate%() Return 0 End End Function Main%() New MyApp Return 0 End |
| ||
Sure the emulator is working? I ran the code you just posted and it worked fine on the emulator. I tried a Nexus 4 and a kindle fire 2nd gen AVD. |
| ||
Oh yes, it's working okay... Also got hold on a real Android device and it does work on that. However that is Android 4.0 and not 4.1 |
| ||
I just do; Import mojo Import monkey You don't have to import monkey, it is automatically imported for you. @BurpyMcFistyGuts - do you get any error messages? |
| ||
No error messages nor anything in the Android log files |
| ||
I get this on emulator running Jelly bean too. I am using genymotion instead of official emulator. This uses virtualbox to run android. I had the same issue with official emulator too on jelly bean. I noticed that if I manually run the virtualbox profile installed by genymotion, then monkey apps work. If I run it through genymotion then it crashes silently. genymotion seems to startup alot quicker than manually starting via virtualbox... Im sure that is not much help to fix the issue? |
| ||
The odd thing is that it works fine in Bluestacks, which is currently my prefered Android emulator. It seems that a Monkey APK file is only compatible with Android 4.1 and below... |
| ||
I can confirm I have created APK's (version 70g - not tried the latest) works with 4.2.2 on emulator and real device. @Burby does the emulator boot ok into the android OS but then fail when it tries to run the APK? are you using the official Nexus or Kindle AVD's? |
| ||
The both emulators boots fine (and other APK files - like GLBasic ones - work fine). It just fails to run the APK properly. Was using the Nexus AVD Could upload a video of it if you like (with Google's emulator) |