Weird crash on android devices after upgrading to 3.3-rc2/ndk-r10d

Hi there,
today I upgraded to cocos2d-x-3.3-rc2 (from 3.3-rc0) and at the same time I switched from android-ndk-r9d to android-ndk-r10d.
Before that everything was fine.

Suddenly I had weird crashes on all android devices I tested. My game crashes immediately at start, even before it’s fully loaded. But no compiling errors.
Took quite a while to figure out what’s wrong. And it doesn’t make sense to me at all to be honest.

Try this:

  • start a new project
  • replace AppDelegate::AppDelegate() {} with
AppDelegate::AppDelegate() {
    float foo = 0.5f;
    if (foo > 1.0f) float bar = log2f(foo);
}
  • try to run the project on an android device (iOS-Simulator had no problems)

The problem is log2f(foo). It crashes the game, even though it is never executed obviously. The crash only happens if the parameter is a variable. log2f(0.5f) would be fine.

I don’t know whether it’s a problem with rc2 or with r10d and after hours of bug searching I’m too tired to find out today, but either way it’s a very strange thing.

Does anybody know what’s happening here?

Oh. And I’m on MacOSX using cocos run -p android to compile and run my game.

Don’t know if it’s related, but when I upgraded from r9d to r10c, I found that some of the std::string functions were no longer supported, and either had to roll my own or use a different function.

That said, I think your issue sounds like it could be more of a compiler being too smart for it’s own good and seeing that the comparison of foo is never true, so it doesn’t store the value properly. if you remove the condition and just process the line float bar = log2f(foo); directly does it the app? Alternatively, if you use foo in a later line, such as a log(), does that help?

I’m sort of just thinking it out here and may be completely off base, but there are a few more avenues to look down.

No, that isn’t the problem. The crash also happens without the condition and in my real game foo and bar are used. I just constructed the case above to show the weirdness of the problem.
That’s the reason why it took so long to find the cause of the crash, because I use log2f() in a Scene that isn’t even created or used at start. But the crash happens immediately.

Could you paste the crash log here?

Hi @owen,

THX for your help.

It’s kind of embarassing, but because I’m kind of new to programming, I don’t know yet how to handle and read crash logs properly. So I just paste part of what I get when typing adb logcat into the terminal. I hope that’s the right way to do it.

I/wpa_supplicant(  528): wlan0: WPA: Group rekeying completed with a6:b1:53:e1:52:1b [GTK=CCMP]
D/dalvikvm(13252): GC_CONCURRENT freed 2496K, 48% free 11955K/22780K, paused 4ms+5ms, total 57ms
D/AndroidRuntime(  870): 
D/AndroidRuntime(  870): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(  870): CheckJNI is ON
I/AndroidRuntime(  870): JNI options: '-Xjniopts:warnonly'
D/dalvikvm(  870): Trying to load lib libjavacore.so 0x0
D/dalvikvm(  870): Added shared lib libjavacore.so 0x0
D/dalvikvm(  870): Trying to load lib libnativehelper.so 0x0
D/dalvikvm(  870): Added shared lib libnativehelper.so 0x0
D/AndroidRuntime(  870): Calling main entry com.android.commands.pm.Pm
I/PackageManager(  367): Removing non-system package:com.mausmausgames.Log
I/ActivityManager(  367): Force stopping package com.mausmausgames.Log appid=10086 user=-1
W/PackageManager(  367): Couldn't delete native library directory /data/app-lib/com.mausmausgames.Log
I/ActivityManager(  367): Force stopping package com.mausmausgames.Log appid=10086 user=0
W/PluginManager( 5425): Can't find plugin: com.mausmausgames.Log
W/PluginManager(13252): Can't find plugin: com.mausmausgames.Log
W/PluginManager( 3558): Can't find plugin: com.mausmausgames.Log
D/dalvikvm(23372): GC_EXPLICIT freed 432K, 10% free 4821K/5340K, paused 3ms+4ms, total 598ms
I/InputReader(  367): Reconfiguring input devices.  changes=0x00000010
I/ActivityManager(  367): Start proc com.android.keychain for broadcast com.android.keychain/.KeyChainBroadcastReceiver: pid=884 uid=1000 gids={41000, 1015, 1028, 3002, 3001, 3003, 1023, 3007}
D/dalvikvm( 6121): GC_CONCURRENT freed 4781K, 47% free 7173K/13348K, paused 120ms+17ms, total 182ms
W/ContextImpl(  884): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1361 android.content.ContextWrapper.startService:450 android.content.ContextWrapper.startService:450 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2376 
I/Choreographer( 6121): Skipped 35 frames!  The application may be doing too much work on its main thread.
D/dalvikvm(  367): GC_EXPLICIT freed 1552K, 48% free 13418K/25448K, paused 150ms+34ms, total 755ms
D/AndroidRuntime(  870): Shutting down VM
D/dalvikvm(  870): GC_CONCURRENT freed 90K, 17% free 457K/548K, paused 0ms+1ms, total 3ms
D/VoicemailCleanupService(23372): Cleaning up data for package: com.mausmausgames.Log
I/ConfigFetchService(12894): PackageReceiver: Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.mausmausgames.Log flg=0x8000010 cmp=com.google.android.gms/.config.ConfigFetchService$PackageReceiver (has extras) }
I/ConfigService(11407): onCreate
I/ConfigService(11407): onBind for Intent { act=com.google.android.gms.config.UPDATE pkg=com.google.android.gms } action com.google.android.gms.config.UPDATE
I/ConfigFetchService(12894): onStartCommand Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.mausmausgames.Log cmp=com.google.android.gms/.config.ConfigFetchService (has extras) }
D/dalvikvm( 6121): GC_FOR_ALLOC freed 860K, 47% free 7112K/13348K, paused 38ms, total 38ms
I/ConfigService(11407): onBind returning update interface
I/ConfigService(11407): onBind for Intent { act=com.google.android.gms.config.START pkg=com.google.android.gms } action com.google.android.gms.config.START
I/ConfigService(11407): onBind returning config service
D/dalvikvm( 6121): GC_CONCURRENT freed 119K, 40% free 8073K/13348K, paused 36ms+10ms, total 108ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 74ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 31ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 23ms
D/dalvikvm( 6121): GC_FOR_ALLOC freed 1497K, 45% free 7470K/13348K, paused 38ms, total 39ms
D/dalvikvm( 6121): GC_CONCURRENT freed 795K, 43% free 7722K/13348K, paused 39ms+10ms, total 95ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 46ms
I/ConfigService(11407): onDestroy
D/PackageBroadcastService(12894): Received broadcast action=android.intent.action.PACKAGE_REMOVED and uri=com.mausmausgames.Log
I/dalvikvm(12894): Could not find method android.os.UserManager.getApplicationRestrictions, referenced from method com.google.android.gms.common.util.a.b
W/dalvikvm(12894): VFY: unable to resolve virtual method 1108: Landroid/os/UserManager;.getApplicationRestrictions (Ljava/lang/String;)Landroid/os/Bundle;
D/dalvikvm(12894): VFY: replacing opcode 0x6e at 0x0014
I/dalvikvm(12894): Could not find method android.accounts.AccountManager.getAccountsByTypeForPackage, referenced from method com.google.android.gms.common.util.a.d
W/dalvikvm(12894): VFY: unable to resolve virtual method 23: Landroid/accounts/AccountManager;.getAccountsByTypeForPackage (Ljava/lang/String;Ljava/lang/String;)[Landroid/accounts/Account;
D/dalvikvm(12894): VFY: replacing opcode 0x6e at 0x000c
I/dalvikvm(12894): Could not find method android.os.UserManager.getUserRestrictions, referenced from method com.google.android.gms.common.util.a.e
W/dalvikvm(12894): VFY: unable to resolve virtual method 1111: Landroid/os/UserManager;.getUserRestrictions ()Landroid/os/Bundle;
D/dalvikvm(12894): VFY: replacing opcode 0x6e at 0x0011
D/AccountUtils(12894): Clearing selected account for com.mausmausgames.Log
D/AndroidRuntime(  910): 
D/AndroidRuntime(  910): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(  910): CheckJNI is ON
I/AndroidRuntime(  910): JNI options: '-Xjniopts:warnonly'
D/dalvikvm(  910): Trying to load lib libjavacore.so 0x0
D/dalvikvm(  910): Added shared lib libjavacore.so 0x0
D/dalvikvm(  910): Trying to load lib libnativehelper.so 0x0
D/dalvikvm(  910): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 6121): GC_CONCURRENT freed 592K, 38% free 8327K/13348K, paused 11ms+3ms, total 53ms
I/ActivityManager(  367): Start proc com.google.android.gms.ui for broadcast com.google.android.gms/com.google.android.location.settings.PackageChangeReceiver: pid=921 uid=10033 gids={50033, 3003, 1007, 3002, 3001, 1028, 1015, 1006, 2001, 3006}
I/MultiDex(  921): VM with version 1.6.0 does not have multidex support
I/MultiDex(  921): install
I/MultiDex(  921): MultiDexExtractor.load(/data/app/com.google.android.gms-1.apk, false)
I/MultiDex(  921): loading existing secondary dex files
I/MultiDex(  921): load found 2 secondary dex files
D/AndroidRuntime(  910): Calling main entry com.android.commands.pm.Pm
I/MultiDex(  921): install done
I/ProviderInstaller(  921): Insert disabled by gate 'gms:security:enable_conscrypt_in_gms_application'
I/LocationSettingsChecker(  921): Removing dialog suppression flag for package com.mausmausgames.Log
I/dalvikvm(12894): Could not find method android.os.StatFs.getBlockSizeLong, referenced from method com.google.android.gms.drive.g.w.a
W/dalvikvm(12894): VFY: unable to resolve virtual method 1216: Landroid/os/StatFs;.getBlockSizeLong ()J
D/dalvikvm(12894): VFY: replacing opcode 0x6e at 0x0008
I/dalvikvm(12894): Could not find method android.os.StatFs.getAvailableBlocksLong, referenced from method com.google.android.gms.drive.g.w.a
W/dalvikvm(12894): VFY: unable to resolve virtual method 1212: Landroid/os/StatFs;.getAvailableBlocksLong ()J
D/dalvikvm(12894): VFY: replacing opcode 0x6e at 0x0019
I/dalvikvm(12894): Could not find method android.os.StatFs.getBlockCountLong, referenced from method com.google.android.gms.drive.g.w.b
W/dalvikvm(12894): VFY: unable to resolve virtual method 1214: Landroid/os/StatFs;.getBlockCountLong ()J
D/dalvikvm(12894): VFY: replacing opcode 0x6e at 0x0019
W/ActivityManager(  367): No content provider found for permission revoke: file:///data/local/tmp/Log-debug.apk
D/dalvikvm(12894): GC_CONCURRENT freed 388K, 7% free 5823K/6244K, paused 3ms+4ms, total 51ms
W/ActivityManager(  367): No content provider found for permission revoke: file:///data/local/tmp/Log-debug.apk
I/PackageManager(  367): Copying native libraries to /data/app-lib/vmdl367708134
I/PeopleContactsSync(12894): CP2 sync disabled
I/Icing   (12894): doRemovePackageData com.mausmausgames.Log
D/dalvikvm(  367): GC_CONCURRENT freed 2412K, 48% free 13344K/25448K, paused 6ms+10ms, total 120ms
D/dalvikvm(  367): WAIT_FOR_CONCURRENT_GC blocked 100ms
D/dalvikvm(  367): WAIT_FOR_CONCURRENT_GC blocked 73ms
I/Choreographer( 6121): Skipped 145 frames!  The application may be doing too much work on its main thread.
D/GCM     (11407): GcmService start Intent { act=com.google.android.gms.INITIALIZE flg=0x10 pkg=com.google.android.gms cmp=com.google.android.gms/.gcm.GcmService } com.google.android.gms.INITIALIZE
D/dalvikvm( 6121): GC_CONCURRENT freed 2429K, 46% free 7250K/13348K, paused 3ms+5ms, total 37ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 28ms
D/dalvikvm( 6121): GC_FOR_ALLOC freed 587K, 46% free 7241K/13348K, paused 56ms, total 56ms
W/GmsApplication(12894): Using Auth Proxy for data requests.
D/LocationInitializer(12894): Restart initialization of location
D/AuthorizationBluetoothService(11407): Received GmsCore event: Intent { act=com.google.android.gms.INITIALIZE flg=0x10 pkg=com.google.android.gms cmp=com.google.android.gms/.auth.be.proximity.authorization.bt.AuthorizationBluetoothService$AutoStarter }.
E/AuthorizationBluetoothService(11407): Proximity feature is not enabled.
W/Searchables(  367): No global search activity found
D/dalvikvm( 6121): GC_FOR_ALLOC freed 197K, 41% free 7893K/13348K, paused 43ms, total 44ms
I/qtaguid (  367): Failed write_ctrl(d 0 10086) res=-1 errno=1
I/qtaguid (  367): Deleteing tag data with tag 0/0 for uid 10086 failed with cnt=0 errno=1
W/NetworkManagementSocketTagger(  367): problem clearing counters for uid 10086 : errno -1
I/Choreographer( 6121): Skipped 86 frames!  The application may be doing too much work on its main thread.
W/GmsApplication(12894): Using Auth Proxy for data requests.
I/Fitness (12894): GmsCore initialized.  Initializing Fitness
D/dalvikvm( 6121): GC_CONCURRENT freed 1366K, 42% free 7788K/13348K, paused 3ms+5ms, total 46ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 35ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 21ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 37ms
D/dalvikvm( 6121): GC_CONCURRENT freed 957K, 40% free 8025K/13348K, paused 2ms+6ms, total 72ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 25ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 24ms
D/dalvikvm( 6121): GC_CONCURRENT freed 493K, 34% free 8842K/13348K, paused 4ms+3ms, total 38ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 7ms
D/dalvikvm( 6121): GC_FOR_ALLOC freed 800K, 37% free 8435K/13348K, paused 25ms, total 25ms
I/dalvikvm-heap( 6121): Grow heap (frag case) to 9.806MB for 1614608-byte allocation
D/dalvikvm( 6121): GC_CONCURRENT freed <1K, 25% free 10011K/13348K, paused 3ms+6ms, total 30ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 24ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 21ms
D/dalvikvm(12894): GC_CONCURRENT freed 299K, 6% free 5979K/6308K, paused 3ms+3ms, total 34ms
W/SQLiteConnectionPool(12894): A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/metrics.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool(12894): A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/help_responses.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool(12894): A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/history_query.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
I/PackageManager(  367): Running dexopt on: com.mausmausgames.Log
D/dalvikvm(23372): GC_CONCURRENT freed 194K, 7% free 5013K/5340K, paused 99ms+2ms, total 126ms
W/DriveInitializer(12894): Background init thread started
W/DriveInitializer(12894): Awaiting to be initialized
W/DriveInitializer(12894): Background init thread ended
D/dalvikvm(12894): GC_CONCURRENT freed 463K, 8% free 6075K/6568K, paused 12ms+6ms, total 67ms
D/dalvikvm(  959): DexOpt: load 322ms, verify+opt 231ms, 524676 bytes
I/ActivityManager(  367): Force stopping package com.mausmausgames.Log appid=10086 user=-1
D/PackageManager(  367): New package installed in /data/app/com.mausmausgames.Log-1.apk
D/dalvikvm(  367): GC_EXPLICIT freed 2198K, 49% free 13206K/25448K, paused 4ms+11ms, total 120ms
D/AndroidRuntime(  910): Shutting down VM
D/dalvikvm(  910): GC_CONCURRENT freed 91K, 17% free 460K/552K, paused 1ms+0ms, total 4ms
I/InputReader(  367): Reconfiguring input devices.  changes=0x00000010
I/ConfigFetchService(12894): PackageReceiver: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.mausmausgames.Log flg=0x8000010 cmp=com.google.android.gms/.config.ConfigFetchService$PackageReceiver (has extras) }
I/ConfigFetchService(12894): onStartCommand Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.mausmausgames.Log cmp=com.google.android.gms/.config.ConfigFetchService (has extras) }
I/ConfigFetchService(12894): launchTask
D/dalvikvm( 6121): GC_FOR_ALLOC freed 3884K, 47% free 7174K/13348K, paused 28ms, total 28ms
I/ConfigService(11407): onCreate
I/ConfigService(11407): onBind for Intent { act=com.google.android.gms.config.UPDATE pkg=com.google.android.gms } action com.google.android.gms.config.UPDATE
D/dalvikvm( 6121): GC_CONCURRENT freed 493K, 42% free 7662K/13152K, paused 2ms+6ms, total 37ms
I/ConfigService(11407): onBind returning update interface
I/ConfigService(11407): onBind for Intent { act=com.google.android.gms.config.START pkg=com.google.android.gms } action com.google.android.gms.config.START
I/ConfigService(11407): onBind returning config service
I/ConfigFetchService(12894): service connected
I/ConfigClient(12894): service connected
D/dalvikvm( 6121): GC_FOR_ALLOC freed 1054K, 45% free 7327K/13152K, paused 30ms, total 31ms
D/PackageBroadcastService(12894): Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=com.mausmausgames.Log
D/AndroidRuntime(  978): 
D/AndroidRuntime(  978): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(  978): CheckJNI is ON
I/AndroidRuntime(  978): JNI options: '-Xjniopts:warnonly'
D/dalvikvm(  978): Trying to load lib libjavacore.so 0x0
D/dalvikvm(  978): Added shared lib libjavacore.so 0x0
D/dalvikvm(  978): Trying to load lib libnativehelper.so 0x0
D/dalvikvm(  978): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 6121): GC_CONCURRENT freed 621K, 41% free 7789K/13152K, paused 2ms+119ms, total 924ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 711ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 688ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 149ms
I/PeopleContactsSync(12894): CP2 sync disabled
I/Choreographer( 6121): Skipped 112 frames!  The application may be doing too much work on its main thread.
D/dalvikvm( 6121): GC_CONCURRENT freed 1725K, 45% free 7285K/13152K, paused 5ms+70ms, total 106ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 90ms
D/dalvikvm( 6121): GC_CONCURRENT freed 601K, 41% free 7891K/13152K, paused 2ms+8ms, total 46ms
D/dalvikvm( 6121): GC_FOR_ALLOC freed 1081K, 42% free 7664K/13152K, paused 29ms, total 29ms
D/dalvikvm( 6121): GC_CONCURRENT freed 965K, 41% free 7877K/13152K, paused 2ms+3ms, total 35ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 14ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 17ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 14ms
W/Searchables(  367): No global search activity found
W/RecognitionManagerService(  367): no available voice recognition services found for user 0
D/dalvikvm( 6121): GC_CONCURRENT freed 553K, 35% free 8573K/13152K, paused 4ms+9ms, total 52ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 43ms
D/dalvikvm( 6121): WAIT_FOR_CONCURRENT_GC blocked 31ms
D/AndroidRuntime(  978): Calling main entry com.android.commands.am.Am
D/dalvikvm(  978): Note: class Landroid/app/ActivityManagerNative; has 158 unimplemented (abstract) methods
D/dalvikvm( 6121): GC_FOR_ALLOC freed 1411K, 36% free 8456K/13152K, paused 31ms, total 31ms
I/dalvikvm-heap( 6121): Grow heap (frag case) to 9.827MB for 1614608-byte allocation
I/ActivityManager(  367): START u0 {flg=0x10000000 cmp=com.mausmausgames.Log/org.cocos2dx.cpp.AppActivity} from pid 978
D/dalvikvm( 6121): GC_FOR_ALLOC freed 1K, 32% free 10031K/14732K, paused 35ms, total 35ms
D/dalvikvm( 6121): GC_CONCURRENT freed 21K, 31% free 10208K/14732K, paused 2ms+8ms, total 50ms
D/AndroidRuntime(  978): Shutting down VM
D/dalvikvm(  978): GC_CONCURRENT freed 91K, 17% free 492K/588K, paused 0ms+0ms, total 4ms
D/dalvikvm(  994): Not late-enabling CheckJNI (already on)
I/ActivityManager(  367): Start proc com.mausmausgames.Log for activity com.mausmausgames.Log/org.cocos2dx.cpp.AppActivity: pid=994 uid=10086 gids={50086, 3003, 1028}
I/dalvikvm(  994): Turning on JNI app bug workarounds for target SDK version 9...
D/dalvikvm(  108): GC_EXPLICIT freed 39K, 2% free 4090K/4160K, paused 3ms+4ms, total 47ms
I/InputReader(  367): Reconfiguring input devices.  changes=0x00000004
I/InputReader(  367): Device reconfigured: id=1, name='gt80x', size 1024x600, orientation 0, mode 1, display id 0
D/dalvikvm(  108): GC_EXPLICIT freed <1K, 2% free 4090K/4160K, paused 3ms+5ms, total 34ms
I/ActivityManager(  367): Config changes=1480 {0.95 ?mcc?mnc de_DE ldltr sw600dp w1024dp h527dp 160dpi lrg land finger -keyb/v/h -nav/h s.67}
D/dalvikvm(  108): GC_EXPLICIT freed <1K, 2% free 4090K/4160K, paused 3ms+3ms, total 33ms
I/qtaguid (  367): Failed write_ctrl(s 1 10086) res=-1 errno=1
W/NetworkManagementSocketTagger(  367): setKernelCountSet(10086, 1) failed with errno -1
D/PhoneApp(  620): updateProximitySensorMode: state = IDLE
D/dalvikvm(  994): Trying to load lib /data/app-lib/com.mausmausgames.Log-1/libcocos2dcpp.so 0x4106cad8
E/dalvikvm(  994): dlopen("/data/app-lib/com.mausmausgames.Log-1/libcocos2dcpp.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "log2f" referenced by "libcocos2dcpp.so"...
D/AndroidRuntime(  994): Shutting down VM
W/dalvikvm(  994): threadid=1: thread exiting with uncaught exception (group=0x40c62930)
E/AndroidRuntime(  994): FATAL EXCEPTION: main
E/AndroidRuntime(  994): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "log2f" referenced by "libcocos2dcpp.so"...
E/AndroidRuntime(  994): 	at java.lang.Runtime.loadLibrary(Runtime.java:371)
E/AndroidRuntime(  994): 	at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime(  994): 	at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
E/AndroidRuntime(  994): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
E/AndroidRuntime(  994): 	at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime(  994): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(  994): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(  994): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  994): 	at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(  994): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  994): 	at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(  994): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(  994): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(  994): 	at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  367):   Force finishing activity com.mausmausgames.Log/org.cocos2dx.cpp.AppActivity
D/dzy     ( 4785):  false
I/ActivityManager(  367): Config changes=1480 {0.95 ?mcc?mnc de_DE ldltr sw600dp w600dp h951dp 160dpi lrg port finger -keyb/v/h -nav/h s.68}
D/PhoneApp(  620): updateProximitySensorMode: state = IDLE
I/InputReader(  367): Reconfiguring input devices.  changes=0x00000004
I/InputReader(  367): Device reconfigured: id=1, name='gt80x', size 1024x600, orientation 1, mode 1, display id 0
D/dalvikvm(23372): GC_CONCURRENT freed 397K, 9% free 5006K/5444K, paused 5ms+3ms, total 32ms
D/dzy     ( 4785):  false
W/ActivityManager(  367): Activity pause timeout for ActivityRecord{41294ee8 u0 com.mausmausgames.Log/org.cocos2dx.cpp.AppActivity}
I/qtaguid (  367): Failed write_ctrl(s 0 10086) res=-1 errno=1
W/NetworkManagementSocketTagger(  367): setKernelCountSet(10086, 0) failed with errno -1
D/dalvikvm(  367): GC_EXPLICIT freed 1265K, 48% free 13282K/25448K, paused 4ms+11ms, total 111ms
I/Process (  994): Sending signal. PID: 994 SIG: 9
I/ActivityManager(  367): Process com.mausmausgames.Log (pid 994) has died.
W/InputMethodManagerService(  367): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41870a88 attribute=null, token = android.os.BinderProxy@4164a6f8
V/ConfigFetchTask(12894): ConfigFetchTask getDeviceDataVersionInfo(): ABFEt1UanGVO0ToCj-uvSDOeE88nrhXQAZMOOOF6k2-0nzqaWDP-Wha96NYuAyLoLdYIp8rtgZf5w_HbAm3Fgca6xd38C3c8q7_xJOTgZNOJairlNJMQZLtudOtL6cnoOihuWSIPTrAei624jo7YhDNUOs9TD3hJGdak7LVDsXHRQdeNLBY9Nn27rrU8j4IcoALAC63MaAal
I/GoogleHttpClient(12894): Falling back to old SSLCertificateSocketFactory

I don’t know exactly which parts belong to my project. The package is called com.mausmausgames.Log.
I think the interesting part starts around line 200, quite at the end.

Thanks a lot for your work.

This is not crash log. Please refer to the following links to get the right crash log.

I’m a bit confused now, could you please specify what you want me to do.

Your links are about a lot of things.
First, they recommend using adb logcat which is exactly what I did.
Then it’s about looking into the /data-folder, but the device has to be rooted to do so.
Then I could implement a library like ACRA for crash reporting in the app…
And so on.

Which one is the way to go?

Wouldn’t it be easier if you try to reproduce the crash the way I described above?
As I’m not very experienced with this kind of stuff as you can see. :wink:

Well, maybe it’s just a misunderstanding, because I posted too much of the log. I’m sorry about that.

This is the part that matters, I think.

E/AndroidRuntime(  994): FATAL EXCEPTION: main
E/AndroidRuntime(  994): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "log2f" referenced by "libcocos2dcpp.so"...
E/AndroidRuntime(  994): 	at java.lang.Runtime.loadLibrary(Runtime.java:371)
E/AndroidRuntime(  994): 	at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime(  994): 	at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
E/AndroidRuntime(  994): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
E/AndroidRuntime(  994): 	at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime(  994): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(  994): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(  994): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  994): 	at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(  994): 	at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(  994): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  994): 	at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(  994): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(  994): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(  994): 	at dalvik.system.NativeStart.main(Native Method)

From the crash log, It seems the symbol log2f can’t be found.

Is the function a system function in Android NDK or is it written by you?

It’s the normal system function from math.h.

The weird thing is, it only crashes if the parameter is a variable not a literal.
And it doesn’t have to be executed to crash the app.
See my first posting.

maybe you should write the literal like this “10.0f” , don’t forget the suffix “f”.

Does it help?

could you make a demo project and upload it to Github?

See my first posting in this thread:

It’s just two lines of code to add to the standard 3.3-rc2/ndk-r10d project.

@mausmausgames I will test it on my own Android device.
Thanks.

Same problem here. Switching to previous ndk (r10c) now. This is my crash report:
(Needless to say, r9d works like a charm)
P.S.: I’m using Cocos JS 3.2 RC0. I know this thread is in the C++ category but I stumbled upon it while searching info about the crash, and it seems related.
Edit: I don’t know if it affects anything, but I accidentally installed the apk located at proj.android/bin rather than the one located at (project)/runtime. I’m going to try again using that one, just in case.

E/AndroidRuntime(19537): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1312]:  1522 cannot locate ' atof'...

E/AndroidRuntime(19537): 

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

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

E/AndroidRuntime(19537): 	at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)

E/AndroidRuntime(19537): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)

E/AndroidRuntime(19537): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)

E/AndroidRuntime(19537): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

E/AndroidRuntime(19537): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)

E/AndroidRuntime(19537): 	at android.app.ActivityThread.access$1500(ActivityThread.java:117)

E/AndroidRuntime(19537): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)

E/AndroidRuntime(19537): 	at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(19537): 	at android.os.Looper.loop(Looper.java:130)

E/AndroidRuntime(19537): 	at android.app.ActivityThread.main(ActivityThread.java:3691)

E/AndroidRuntime(19537): 	at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(19537): 	at java.lang.reflect.Method.invoke(Method.java:507)

E/AndroidRuntime(19537): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)

E/AndroidRuntime(19537): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)

E/AndroidRuntime(19537): 	at dalvik.system.NativeStart.main(Native Method)