Fatal error when lauching Android apk

Hello all,

I just started the migration from ant to Android Studio for our project. Everything work well on Android 6 (Samsung Galaxy S7)

But when i launch apk on device HUAWEI with old version Android 4. i have an Android RunTime error : 

FATAL EXCEPTION: main

java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler …

It seems that he doesn’t include well Corona Class … Any advice would be very helpfull

Thanks,

Hi pastor4,

What daily build of Corona are you using? Can you provide us with the full stack trace after that NoClassDefFoundError occurs?

Also, can you provide more specific info on your device? I just tried our our HelloWorld sample using daily build 2016.2992 on a Huawei Honor 3C running Android 4.4.2 and am unable to reproduce the issue.

Hi, we have the same daily build 2016.2992. Device is HUAWER Y330 U01 on Android 4.2.2

Here is the full error log :

12-05 10:19:38.679 1380-1380/? E/AndroidRuntime: FATAL EXCEPTION: main

                                                 java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler

                                                     at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:49)

                                                     at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:224)

                                                     at android.app.Activity.performCreate(Activity.java:5211)

                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)

                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2328)

                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2416)

                                                     at android.app.ActivityThread.access$600(ActivityThread.java:166)

                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)

                                                     at android.os.Handler.dispatchMessage(Handler.java:107)

                                                     at android.os.Looper.loop(Looper.java:194)

                                                     at android.app.ActivityThread.main(ActivityThread.java:5455)

                                                     at java.lang.reflect.Method.invokeNative(Native Method)

                                                     at java.lang.reflect.Method.invoke(Method.java:525)

                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:966)

                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:733)

                                                     at dalvik.system.NativeStart.main(Native Method)

Hmm, very strange that it works on 1 phone, but not the HUAWEI Y330 U01.

If you haven’t already, see if you can reproduce that crash by simply running our HelloWorld sample in both the Corona Simulator and in the Enterprise project you’ve set up in Android Studio.

Post the results of those two tests here and we can continue investigating what’s happening.

Everything work on Corona SDK. 

I just tried the HelloWorld sample in our Enterprise project, i have the same error. I also deleted all our external plugins that may cause troubles, but i have always this error.

We should miss something. Maybe Android 4.2.2 is too old ?

Here the full error log maybe it can help :

12-07 11:34:31.608 16693-16693/? I/dalvikvm: Could not find method com.ansca.corona.CoronaActivity.requestPermissions, referenced from method com.ansca.corona.CoronaActivity.showCameraWindowUsing

12-07 11:34:31.608 16693-16693/? W/dalvikvm: VFY: unable to resolve virtual method 20397: Lcom/ansca/corona/CoronaActivity;.requestPermissions ([Ljava/lang/String;I)V

12-07 11:34:31.610 16693-16693/? I/dalvikvm: Could not find method com.ansca.corona.CoronaActivity.requestPermissions, referenced from method com.ansca.corona.CoronaActivity.showCameraWindowUsing

12-07 11:34:31.611 16693-16693/? W/dalvikvm: VFY: unable to resolve virtual method 20397: Lcom/ansca/corona/CoronaActivity;.requestPermissions ([Ljava/lang/String;I)V

12-07 11:34:31.631 16693-16693/? I/dalvikvm: Could not find method android.app.Activity.onRequestPermissionsResult, referenced from method com.ansca.corona.CoronaActivity.onRequestPermissionsResult

12-07 11:34:31.737 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.737 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.737 16693-16693/? E/dalvikvm: Could not find class ‘com.ansca.corona.CoronaLuaErrorHandler’, referenced from method com.ansca.corona.CoronaEnvironment.<clinit>

12-07 11:34:31.737 16693-16693/? W/dalvikvm: VFY: unable to resolve new-instance 2670 (Lcom/ansca/corona/CoronaLuaErrorHandler;) in Lcom/ansca/corona/CoronaEnvironment;

12-07 11:34:31.741 16693-16693/? E/dalvikvm: Could not find class ‘com.naef.jnlua.LuaState’, referenced from method com.ansca.corona.CoronaEnvironment.invokeLuaErrorHandler

12-07 11:34:31.741 16693-16693/? W/dalvikvm: VFY: unable to resolve new-instance 9393 (Lcom/naef/jnlua/LuaState;) in Lcom/ansca/corona/CoronaEnvironment;

12-07 11:34:31.743 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.743 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.745 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.746 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.747 16693-16693/? I/dalvikvm: Could not find method com.ansca.corona.CoronaLuaErrorHandler.setController, referenced from method com.ansca.corona.CoronaEnvironment.setController

12-07 11:34:31.747 16693-16693/? W/dalvikvm: VFY: unable to resolve virtual method 20733: Lcom/ansca/corona/CoronaLuaErrorHandler;.setController (Lcom/ansca/corona/Controller;)V

12-07 11:34:31.756 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.756 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.756 16693-16693/? D/dalvikvm: DexOpt: unable to opt direct call 0x50f7 at 0x10 in Lcom/ansca/corona/CoronaEnvironment;.<clinit>

12-07 11:34:31.759 16693-16693/? D/dalvikvm: DexOpt: unable to opt direct call 0xee59 at 0x0e in Lcom/ansca/corona/CoronaEnvironment;.invokeLuaErrorHandler

12-07 11:34:31.762 16693-16693/? W/dalvikvm: Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/ansca/corona/CoronaEnvironment;

12-07 11:34:31.764 16693-16693/? I/dalvikvm: java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler

12-07 11:34:31.764 16693-16693/? I/dalvikvm:     at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:49)

12-07 11:34:31.764 16693-16693/? I/dalvikvm:     at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:224)

12-07 11:34:31.770 16693-16693/? E/AndroidRuntime: FATAL EXCEPTION: main

                                                   java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler

                                                       at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:49)

                                                       at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:224)

                                                       at android.app.Activity.performCreate(Activity.java:5211)

                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)

                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2328)

                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2416)

                                                       at android.app.ActivityThread.access$600(ActivityThread.java:166)

                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)

                                                       at android.os.Handler.dispatchMessage(Handler.java:107)

                                                       at android.os.Looper.loop(Looper.java:194)

                                                       at android.app.ActivityThread.main(ActivityThread.java:5455)

                                                       at java.lang.reflect.Method.invokeNative(Native Method)

                                                       at java.lang.reflect.Method.invoke(Method.java:525)

                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:966)

                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:733)

                                                       at dalvik.system.NativeStart.main(Native Method)

12-07 11:34:31.777 558-1419/? W/ActivityManager:   Force finishing activity com.orchestra.keetiz/com.ansca.corona.CoronaActivity

12-07 11:34:32.284 558-574/? W/ActivityManager: Activity pause timeout for ActivityRecord{43121e38 u0 com.orchestra.keetiz/com.ansca.corona.CoronaActivity}

12-07 11:34:32.284 558-574/? V/ActivityManager: Enqueueing pending finish: ActivityRecord{43121e38 u0 com.orchestra.keetiz/com.ansca.corona.CoronaActivity}

For Android versions, we support all the way back to Android 2.3.3, so the OS version of the device shouldn’t be an issue.

This is starting to sound more like there’s something strange going on with your Android Studio project setup. Try running our Enterprise App Template on that device. You can find the Android Studio project for this at /Applications/CoronaEnterprise/ProjectTemplates/App/android.

Assuming that runs fine on your phone, try to isolate what about your Android Studio project setup is different.

If that doesn’t work, try using a clean copy of CoronaEnterprise.

Hi pastor4,

What daily build of Corona are you using? Can you provide us with the full stack trace after that NoClassDefFoundError occurs?

Also, can you provide more specific info on your device? I just tried our our HelloWorld sample using daily build 2016.2992 on a Huawei Honor 3C running Android 4.4.2 and am unable to reproduce the issue.

Hi, we have the same daily build 2016.2992. Device is HUAWER Y330 U01 on Android 4.2.2

Here is the full error log :

12-05 10:19:38.679 1380-1380/? E/AndroidRuntime: FATAL EXCEPTION: main

                                                 java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler

                                                     at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:49)

                                                     at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:224)

                                                     at android.app.Activity.performCreate(Activity.java:5211)

                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)

                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2328)

                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2416)

                                                     at android.app.ActivityThread.access$600(ActivityThread.java:166)

                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)

                                                     at android.os.Handler.dispatchMessage(Handler.java:107)

                                                     at android.os.Looper.loop(Looper.java:194)

                                                     at android.app.ActivityThread.main(ActivityThread.java:5455)

                                                     at java.lang.reflect.Method.invokeNative(Native Method)

                                                     at java.lang.reflect.Method.invoke(Method.java:525)

                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:966)

                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:733)

                                                     at dalvik.system.NativeStart.main(Native Method)

Hmm, very strange that it works on 1 phone, but not the HUAWEI Y330 U01.

If you haven’t already, see if you can reproduce that crash by simply running our HelloWorld sample in both the Corona Simulator and in the Enterprise project you’ve set up in Android Studio.

Post the results of those two tests here and we can continue investigating what’s happening.

Everything work on Corona SDK. 

I just tried the HelloWorld sample in our Enterprise project, i have the same error. I also deleted all our external plugins that may cause troubles, but i have always this error.

We should miss something. Maybe Android 4.2.2 is too old ?

Here the full error log maybe it can help :

12-07 11:34:31.608 16693-16693/? I/dalvikvm: Could not find method com.ansca.corona.CoronaActivity.requestPermissions, referenced from method com.ansca.corona.CoronaActivity.showCameraWindowUsing

12-07 11:34:31.608 16693-16693/? W/dalvikvm: VFY: unable to resolve virtual method 20397: Lcom/ansca/corona/CoronaActivity;.requestPermissions ([Ljava/lang/String;I)V

12-07 11:34:31.610 16693-16693/? I/dalvikvm: Could not find method com.ansca.corona.CoronaActivity.requestPermissions, referenced from method com.ansca.corona.CoronaActivity.showCameraWindowUsing

12-07 11:34:31.611 16693-16693/? W/dalvikvm: VFY: unable to resolve virtual method 20397: Lcom/ansca/corona/CoronaActivity;.requestPermissions ([Ljava/lang/String;I)V

12-07 11:34:31.631 16693-16693/? I/dalvikvm: Could not find method android.app.Activity.onRequestPermissionsResult, referenced from method com.ansca.corona.CoronaActivity.onRequestPermissionsResult

12-07 11:34:31.737 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.737 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.737 16693-16693/? E/dalvikvm: Could not find class ‘com.ansca.corona.CoronaLuaErrorHandler’, referenced from method com.ansca.corona.CoronaEnvironment.<clinit>

12-07 11:34:31.737 16693-16693/? W/dalvikvm: VFY: unable to resolve new-instance 2670 (Lcom/ansca/corona/CoronaLuaErrorHandler;) in Lcom/ansca/corona/CoronaEnvironment;

12-07 11:34:31.741 16693-16693/? E/dalvikvm: Could not find class ‘com.naef.jnlua.LuaState’, referenced from method com.ansca.corona.CoronaEnvironment.invokeLuaErrorHandler

12-07 11:34:31.741 16693-16693/? W/dalvikvm: VFY: unable to resolve new-instance 9393 (Lcom/naef/jnlua/LuaState;) in Lcom/ansca/corona/CoronaEnvironment;

12-07 11:34:31.743 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.743 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.745 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.746 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.747 16693-16693/? I/dalvikvm: Could not find method com.ansca.corona.CoronaLuaErrorHandler.setController, referenced from method com.ansca.corona.CoronaEnvironment.setController

12-07 11:34:31.747 16693-16693/? W/dalvikvm: VFY: unable to resolve virtual method 20733: Lcom/ansca/corona/CoronaLuaErrorHandler;.setController (Lcom/ansca/corona/Controller;)V

12-07 11:34:31.756 16693-16693/? I/dalvikvm: Failed resolving Lcom/ansca/corona/CoronaLuaErrorHandler; interface 9390 ‘Lcom/naef/jnlua/JavaFunction;’

12-07 11:34:31.756 16693-16693/? W/dalvikvm: Link of class ‘Lcom/ansca/corona/CoronaLuaErrorHandler;’ failed

12-07 11:34:31.756 16693-16693/? D/dalvikvm: DexOpt: unable to opt direct call 0x50f7 at 0x10 in Lcom/ansca/corona/CoronaEnvironment;.<clinit>

12-07 11:34:31.759 16693-16693/? D/dalvikvm: DexOpt: unable to opt direct call 0xee59 at 0x0e in Lcom/ansca/corona/CoronaEnvironment;.invokeLuaErrorHandler

12-07 11:34:31.762 16693-16693/? W/dalvikvm: Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/ansca/corona/CoronaEnvironment;

12-07 11:34:31.764 16693-16693/? I/dalvikvm: java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler

12-07 11:34:31.764 16693-16693/? I/dalvikvm:     at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:49)

12-07 11:34:31.764 16693-16693/? I/dalvikvm:     at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:224)

12-07 11:34:31.770 16693-16693/? E/AndroidRuntime: FATAL EXCEPTION: main

                                                   java.lang.NoClassDefFoundError: com.ansca.corona.CoronaLuaErrorHandler

                                                       at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:49)

                                                       at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:224)

                                                       at android.app.Activity.performCreate(Activity.java:5211)

                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)

                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2328)

                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2416)

                                                       at android.app.ActivityThread.access$600(ActivityThread.java:166)

                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)

                                                       at android.os.Handler.dispatchMessage(Handler.java:107)

                                                       at android.os.Looper.loop(Looper.java:194)

                                                       at android.app.ActivityThread.main(ActivityThread.java:5455)

                                                       at java.lang.reflect.Method.invokeNative(Native Method)

                                                       at java.lang.reflect.Method.invoke(Method.java:525)

                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:966)

                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:733)

                                                       at dalvik.system.NativeStart.main(Native Method)

12-07 11:34:31.777 558-1419/? W/ActivityManager:   Force finishing activity com.orchestra.keetiz/com.ansca.corona.CoronaActivity

12-07 11:34:32.284 558-574/? W/ActivityManager: Activity pause timeout for ActivityRecord{43121e38 u0 com.orchestra.keetiz/com.ansca.corona.CoronaActivity}

12-07 11:34:32.284 558-574/? V/ActivityManager: Enqueueing pending finish: ActivityRecord{43121e38 u0 com.orchestra.keetiz/com.ansca.corona.CoronaActivity}

For Android versions, we support all the way back to Android 2.3.3, so the OS version of the device shouldn’t be an issue.

This is starting to sound more like there’s something strange going on with your Android Studio project setup. Try running our Enterprise App Template on that device. You can find the Android Studio project for this at /Applications/CoronaEnterprise/ProjectTemplates/App/android.

Assuming that runs fine on your phone, try to isolate what about your Android Studio project setup is different.

If that doesn’t work, try using a clean copy of CoronaEnterprise.