Android debug mode works, but release don't. Crashes at launch

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:


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):

Total time: 6 seconds
Move apk to D:\Documents\VisualStudio\Projects\CocosProjects\GameTest\bin\relea
build succeeded.
Running command: deploy
Deploying mode: release
installing on device
running: '"D:\Documents\Android\sdk\platform-tools\adb" uninstall

running: '"D:\Documents\Android\sdk\platform-tools\adb" install "D:\Documents\V

4847 KB/s (6237724 bytes in 1.256s)
        pkg: /data/local/tmp/GameTest-release-signed.apk
Running command: run
starting application
running: '"D:\Documents\Android\sdk\platform-tools\adb" shell am start -n "com.

Starting: Intent { }

Something must be known about release mode, before launching? (something like keystore, or any config that must be done before?)

1 Like

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 ""...

E/AndroidRuntime(16609):     at java.lang.Runtime.loadLibrary(

E/AndroidRuntime(16609):     at java.lang.System.loadLibrary(

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/


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


I have created a bug for this:

1 Like

The “workaround” is to set APP_PLATFORM=android-20 in I haven’t tested it on APIs < 16 though, it might not work there.

1 Like