Android activity class names, underscores and hair loss


#1

just fyi: wanted to share this in order to prevent premature hair loss in other Android devs :wink:

if your Android activity class name (the one you specify in introjucer) has an underscore in it (e.g. ‘tonespace_app’ in my case), Android apparently gets confused as to what is the proper native resumeApp() function to call for your app. The result is a fatal exception at application startup:

E/AndroidRuntime( 7884): FATAL EXCEPTION: main E/AndroidRuntime( 7884): java.lang.UnsatisfiedLinkError: Native method not found: com.mucoder.tonespace_app.resumeApp:()V E/AndroidRuntime( 7884): at com.mucoder.tonespace_app.resumeApp(Native Method) E/AndroidRuntime( 7884): at com.mucoder.tonespace_app.onResume(tonespace_app.java:99) E/AndroidRuntime( 7884): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185) E/AndroidRuntime( 7884): at android.app.Activity.performResume(Activity.java:5182) E/AndroidRuntime( 7884): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732) E/AndroidRuntime( 7884): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771) E/AndroidRuntime( 7884): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235) E/AndroidRuntime( 7884): at android.app.ActivityThread.access$600(ActivityThread.java:141) E/AndroidRuntime( 7884): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) E/AndroidRuntime( 7884): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 7884): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 7884): at android.app.ActivityThread.main(ActivityThread.java:5041) E/AndroidRuntime( 7884): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 7884): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 7884): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime( 7884): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime( 7884): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 477): Force finishing activity com.mucoder/.tonespace_app W/ActivityManager( 477): Activity pause timeout for ActivityRecord{4266f988 u0 com.mucoder/.tonespace_app} I/ActivityManager( 477): No longer want com.google.android.gallery3d (pid 6687): empty #17 W/ActivityManager( 477): Activity destroy timeout for ActivityRecord{4266f988 u0 com.mucoder/.tonespace_app}

the solution is to get rid of the underscore (in my case: tonespace_app -> tonespaceapp)

this is with android sdk/ndk 21 running on an ubuntu 12.04 box


Android exception - no implementation for resumeApp()