[Need Help] Android app crash on launch

Hi There…
Since upgrading to 3.2rc0 my app crash on android when it is launching…
This is the log…

I/ActivityManager(  336): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.tgv/org.cocos2dx.javascript.AppActivity} from pid 20463
I/ActivityManager(  336): Start proc com.tgv for activity com.tgv/org.cocos2dx.javascript.AppActivity: pid=20478 uid=10069 gids={50069, 3003, 1015, 1028}
D/dalvikvm(20478): Trying to load lib /data/app-lib/com.tgv-1/libcocos2djs.so 0x41229330
E/dalvikvm(20478): dlopen("/data/app-lib/com.tgv-1/libcocos2djs.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "atof" referenced by "libcocos2djs.so"...
E/AndroidRuntime(20478): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "atof" referenced by "libcocos2djs.so"...
E/AndroidRuntime(20478): 	at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
E/AndroidRuntime(20478): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
E/AndroidRuntime(20478): 	at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:47)
W/ActivityManager(  336):   Force finishing activity com.tgv/org.cocos2dx.javascript.AppActivity
W/ActivityManager(  336): Activity pause timeout for ActivityRecord{412442a8 u0 com.tgv/org.cocos2dx.javascript.AppActivity}
I/ActivityManager(  336): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tgv/org.cocos2dx.javascript.AppActivity} from pid 549
I/ActivityManager(  336): Start proc com.tgv for activity com.tgv/org.cocos2dx.javascript.AppActivity: pid=20521 uid=10069 gids={50069, 3003, 1015, 1028}
D/dalvikvm(20521): Trying to load lib /data/app-lib/com.tgv-1/libcocos2djs.so 0x4122a0a0
E/dalvikvm(20521): dlopen("/data/app-lib/com.drawnintocode.tgv-1/libcocos2djs.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "atof" referenced by "libcocos2djs.so"...
E/AndroidRuntime(20521): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "atof" referenced by "libcocos2djs.so"...
E/AndroidRuntime(20521): 	at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
E/AndroidRuntime(20521): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
E/AndroidRuntime(20521): 	at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:47)
W/ActivityManager(  336):   Force finishing activity com.tgv/org.cocos2dx.javascript.AppActivity
W/ActivityManager(  336): Activity pause timeout for ActivityRecord{41244400 u0 com.tgv/org.cocos2dx.javascript.AppActivity}

i am using ndk r10c

The issue is known and documented here.

https://code.google.com/p/android/issues/detail?id=73725

Cocos should probably use strtod instead of atof, but in the mean time, you can implement atof yourself in one of your source files to provide the symbol.

static __inline__ double atof(const char *nptr)
{
    return (strtod(nptr, NULL));
}

Thank you for the info…
can you tell me where i should put the code…
i didn’t specify that it was js branch i am using…

Any cpp file should do. AppDelegate.cpp for example. Remove the static and inline for putting in a .cpp file.

Ok thanks, i did that. Now i see rand is missing.
So i am looking around the net for the rand function.
What i really want to know, is what other functions are missing?

The link I posted at the top documents a list of the functions that have changed I believe.

so i add this…

int AppDelegate::rand(void)
{
    /* LINTED integer overflow */
    return (int)((next = next * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
}

but it still saying i am missing rand…

The method signature needs to match. Don’t declare it as a c++ method.

use…

int rand()
{
}

Also for a better RNG you might try arc4random and see if that is available.

1 Like

Thank you…
It work now…
So it was just atof and rand missing it seems…

1 Like

tipsycoder, can you please share the full code that you used ?