简体   繁体   中英

Android apps - html5 + cocoonjs doesnt work?

i have a bunch of questions, so i hope you guys will give me a helping hand :)

I got a test app in HTML5 and used ludei/cocoonjs to get adroid app. I tried to run it on AVD from ADT on Android 2.3/3.0/4.2 and all i got was "Sorry, application suddenly stopped".

So here are my questions:

  1. Is there any way to test android apps on PC machine using emulator?
  2. Will my app work on mobiles although it doesnt work on emulator? I tested it on my friend mobile and was working fine..
  3. What android version is ludei/cocoon compatible with?
  4. I want to buy a cheap smartphone to test my application, but im not decided yet, cause i cant runn apps on emulator. Do you think LG Swift L3 (Android 2.3.6) is enough to test C2 + Ludei apps?

Thanks in advance for answers and sorry for my english, im not native speaker/writer.

Actually you can get CocoonJS work with Emulator. I had some mailings with Ludei before to track down a JNI bug, here are come excerpts about how to start a compatible emulator. This was a few months ago, and also the version from 2013.07.26 with apk md5sum 55aa7f226b04d698382a604299357094, version 1.3 (although it is advertised to be 1.4).

The key part is the -gpu on switch, and optionally switching off JNI checks (for emulators / certain rooted devices):

  1. Updated SDK Tools to r21, Platform-tools to r16
  2. tools$ ./android create avd -n A15 -t android-15 #(can also make higher platform level emulator)
  3. tools$ ./emulator -avd A15 -gpu on
  4. platform-tools$ wget http://storage.cocoonjsservice.ludei.com/CocoonJSLauncher.apk
  5. (Optional) Remove previous version ./adb uninstall com.ideateca.cocoonjslauncher
  6. ./adb install CocoonJSLauncher.apk
  7. ./adb logcat
  8. Start app on emulator, observe logs

Optionally disable JNI checks to workaround CocoonJS bugs (if starting CocoonJS fails with JNI exception, something like "JNI WARNING: 0x412c40a8 is not a valid JNI reference"):

adb shell stop
adb shell setprop dalvik.vm.checkjni false
adb shell start

(then emulator/device restarts, after restart JNI checks are not made, source: http://developer.android.com/training/articles/perf-jni.html )

By the way, setting checkjni to true using the above method on a real non-rooted device also causes the problem, if you want to check.

Box2D, Sprite demo, Fonts demo works, didn't check others.

  1. An .apk generated on the cloud compiler of CocoonJS will not work on the emulator, you need a real device to test an .apk.
  2. CocoonJS is compatible with Android 2.3 - 4.x.
  3. LG Swift L3 is a very simple device to test a game, my advise is to try with a device with at least 512mb ram.

Regards

if you are using windows , perhaps you may find Intel xdk very helpful to run your simulations and the emulators are easy there for android .

speaking of testing the app in native environment , i found phonegap is nice and pretty simple , all you have to do is after uploading your zip file they general for you a .apk file which you can test in real device in any mobile store , you dnt have to buy a mobile to test your app , and if you do HUSTLE to go to nearest mobile shope test it there using scanning QR code from the adobe phonegap build.

And if you dnt want that , there is another platform to test your app via codepen.io it gives a really nice output in different size screen as you needed.

PhoneGap

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM