Trying to run a project (hello world with few things) on release mode, but crashes at launch: Unfortunately [AppName], has stopped.
Same project works on debug mode
On Project Folder:
Works:
cocos run -p android -m debug
Crashes at launch:
cocos run -p android -m release
Cocos2d-x 3.4
Win 8.1 x64
NDK r10c (4.9)
API level 21
Moto E (Android 4.4.4)
Last part of console (build and launch):
BUILD SUCCESSFUL
Total time: 6 seconds
Move apk to D:\Documents\VisualStudio\Projects\CocosProjects\GameTest\bin\relea
e\android
build succeeded.
Running command: deploy
Deploying mode: release
installing on device
running: '"D:\Documents\Android\sdk\platform-tools\adb" uninstall com.game.test
Success
running: '"D:\Documents\Android\sdk\platform-tools\adb" install "D:\Documents\V
sualStudio\Projects\CocosProjects\GameTest\bin\release\android\GameTest-release
signed.apk"'
4847 KB/s (6237724 bytes in 1.256s)
pkg: /data/local/tmp/GameTest-release-signed.apk
Success
Running command: run
starting application
running: '"D:\Documents\Android\sdk\platform-tools\adb" shell am start -n "com.
ame.test/org.cocos2dx.cpp.AppActivity"'
Starting: Intent { cmp=com.game.test/org.cocos2dx.cpp.AppActivity }
D:\Documents\VisualStudio\Projects\CocosProjects\GameTest>
Something must be known about release mode, before launching? (something like keystore, or any config that must be done before?)
1 Like
nite
March 3, 2015, 1:11am
#2
Can you also provide your adb logcat output?
Solved with r9d. Logcat output can be seen through a file or console? I’m not using any java IDE.
Getting the logcat is a pretty fundamental thing to do as an Android developer. See Google’s help page for details.
Testing again with r10c:
W/dalvikvm(16609): threadid=1: thread exiting with uncaught exception (group=0x41690d40)
E/AndroidRuntime(16609): FATAL EXCEPTION: main
E/AndroidRuntime(16609): Process: com.home.gameapp, PID: 16609
E/AndroidRuntime(16609): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "srand" referenced by "libcocos2dcpp.so"...
E/AndroidRuntime(16609): at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime(16609): at java.lang.System.loadLibrary(System.java:526)
r9d works because builds with android-19
r10c builds directly with android-21 = Android 5.0+ only i think ,and my device is running with 4.4.4.
Solution with r10c: jni/Application.mk
APP_PLATFORM=android-19
Not sure (can’t test) if android-19 will work on older (like Android 2.3) versions
This relates to an issue where some functions, including atof()
and srand()
, were static inline
before android-21 but have been moved into the library .so
file since then. If you compile your app against the android-21 and run it on a pre-android-21 device you will get this error.
I would imagine the answer is to ensure your app does not run on a version of android less than the one it was compiled against.
1 Like
I think it is not an optimal solution to build ur game for each android version befor run it then u will have 10 differents apk for 10 android version for example…
I face the same problem but I change the ndk version to r9 then it works for all android versions
2 Likes
I have created a bug for this:
1 Like
The “workaround” is to set APP_PLATFORM=android-20
in Application.mk. I haven’t tested it on APIs < 16 though, it might not work there.
1 Like