Seen from builds 1061, 1063 and 1065 in the Google Play Developer console. It has happened three times each on Android 4.2, 4.4 and 5.1 (so not very frequently). There is a recent user message that says "legal help page" but I don't know what that means.
java.lang.RuntimeException: Unable to instantiate application org.odk.collect.android.application.Collect: java.lang.ClassNotFoundException: Didn't find class "org.odk.collect.android.application.Collect" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:628)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4964)
at android.app.ActivityThread.access$1600(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1491)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5910)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.odk.collect.android.application.Collect" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:987)
at android.app.LoadedApk.makeApplication(LoadedApk.java:623)
... 10 more
Suppressed: java.lang.ClassNotFoundException: org.odk.collect.android.application.Collect
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
This StackOverflow post has some ideas to explore.
@shobhitagarwal1612, this looks like it could be related to the issue you're running into. Have you been using the emulator or a real phone? Can you try the other to see if it still happens?
I am using my Xolo Q700s Plus, (Android 4.4)
I have also tested on RedMi Note 3, Android 6.0)
@shobhitagarwal1612 Can you give the emulator a try, too? I'm still not totally sure this is the same issue since it's not exactly the same stack trace than you're getting but it would be interesting to know if the emulator works.
I'll try once again using a clean build
@lognaturel I used a clean build and reinstalled the apk. Now, the app is running on RedMi Note 3 (Android 6) but throwing the same error on Xolo Q700s plus(Kitkat, Android 4.4). Thanks for the suggestion
I tried to run on an API 9 emulator which worked a few days ago and now I get INSTALL_FAILED_DEXOPT even after a clean build. No idea if this is related or not. I've tried several suggestions from SO with no luck. No problems running on an API 19 (Android 4.4) emulator.
The big recent change related to all this is that MultiDex support was added just a few days ago. This particular issue has been ongoing since build 1061 but not very frequent.
I've added a few more pieces of information from the dev console to the original issue.
This is @shobhitagarwal1612's stack trace reported on Slack:
02-04 01:51:04.067 9599-9599/org.odk.collect.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.odk.collect.android, PID: 9599
java.lang.RuntimeException: Unable to get provider org.odk.collect.android.provider.InstanceProvider: java.lang.ClassNotFoundException: Didn't find class "org.odk.collect.android.provider.InstanceProvider" on path: DexPathList[[zip file "/data/app/org.odk.collect.android-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.odk.collect.android, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5011)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4582)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.odk.collect.android.provider.InstanceProvider" on path: DexPathList[[zip file "/data/app/org.odk.collect.android-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.odk.collect.android, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:4996)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4582)聽
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)聽
at android.app.ActivityThread.access$1500(ActivityThread.java:151)聽
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)聽
at android.os.Handler.dispatchMessage(Handler.java:110)聽
at android.os.Looper.loop(Looper.java:193)聽
at android.app.ActivityThread.main(ActivityThread.java:5292)聽
at java.lang.reflect.Method.invokeNative(Native Method)聽
at java.lang.reflect.Method.invoke(Method.java:515)聽
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)聽
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)聽
at dalvik.system.NativeStart.main(Native Method)聽
This sounds a lot like a MultiDex issue I saw with a Collect port I was working on. I solved it by adding a call to attachBaseContext in the Application class. See the line here.
Apologies if this discussion is happening against a branch where this is already added. I don't see it on master. The main fix is this:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
edit: Added some much needed context.
If it does turn out to be this, I should add that this was one of the most annoying bugs I've encountered. It was crashing in the field, I had no idea why, and the importance of MultiDex.install is completely under-emphasized in the docs.
The repo I linked to there is a MultiDex version of Collect that I got working on at least as low as 4.4, so if it isn't this issue there might be something else in the config files or something that is helpful.
Thanks for jumping in and sharing your wisdom @srsudar! That all seems like a super promising first direction to explore and it's certainly completely new to me.
@srsudar Thanks
@shobhitagarwal1612 Do you want to take a first stab at trying those changes and either report back on what you discover or if it fixes your problem, issue a PR? You're the only one who is able to reproduce this reliably so it would be super helpful!
@lognaturel I tried adding
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
in Collect.java and it worked for me. Thanks @srsudar
@lognaturel I will issue a PR making those changes.
@lognaturel I have issued the PR #391. Please review
I still have the same issue here ! How can I fix it ?
@mfaragallah Please file a new issue with all the information about device version, etc.
Hi,
Still i have same issue how can solve it ? Already i have used it.
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
in this line but app is crash not supported for it. please give some idea.
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.math.MathUtils"
Hi, I am getting below error while integrating reactnative android aar file in another project.
Please help me to solve this problem..
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/demos/helloworld/MyReactActivity;
at com.demos.helloworld.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.ClassNotFoundException: com.demos.helloworld.MyReactActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.demos.helloworld.MainActivity.onCreate(MainActivity.java:19)聽
at android.app.Activity.performCreate(Activity.java:6662)聽
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)聽
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)聽
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)聽
at android.app.ActivityThread.-wrap12(ActivityThread.java)聽
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)聽
at android.os.Handler.dispatchMessage(Handler.java:102)聽
at android.os.Looper.loop(Looper.java:154)聽
at android.app.ActivityThread.main(ActivityThread.java:6077)聽
at java.lang.reflect.Method.invoke(Native Method)聽
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)聽
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)聽
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;
at com.demos.helloworld.MainActivity.onCreate(MainActivity.java:19)聽
at android.app.Activity.performCreate(Activity.java:6662)聽
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)聽
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)聽
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)聽
at android.app.ActivityThread.-wrap12(ActivityThread.java)聽
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)聽
at android.os.Handler.dispatchMessage(Handler.java:102)聽
at android.os.Looper.loop(Looper.java:154)聽
at android.app.ActivityThread.main(ActivityThread.java:6077)聽
at java.lang.reflect.Method.invoke(Native Method)聽
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)聽
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)聽
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.modules.core.DefaultHardwareBackBtnHandler" on path: DexPathList[[zip file "/data/app/reacttest.prime.com.aarimplementation-1/base.apk"],nativeLibraryDirectories=[/data/app/reacttest.prime.com.aarimplementation-1/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.demos.helloworld.MainActivity.onCreate(MainActivity.java:19)聽
at android.app.Activity.performCreate(Activity.java:6662)聽
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)聽
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)聽
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)聽
at android.app.ActivityThread.-wrap12(ActivityThread.java)聽
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)聽
at android.os.Handler.dispatchMessage(Handler.java:102)聽
at android.os.Looper.loop(Looper.java:154)聽
at android.app.ActivityThread.main(ActivityThread.java:6077)聽
at java.lang.reflect.Method.invoke(Native Method)聽
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)聽
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)聽
@kkvarma @sweta01 Those issues don't seem related to ODK Collect. Please get in touch with the projects you are working with. Good luck!
I still have the same issue, I an extending MultidexApplication in my app class and I see that the MultidexApplication already calls the Multidex.install() method. However I see this crash only in android versions 6.0 and below
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
this worked for me in Application class thanks :)
I guess you might have found out what was wrong by now, I ran into the same problem. It turned out when I created my application class, it was not under any package (weird). I only had to move it under the main package: com.mycompany.example
im also facing this issue
what is weird is its looking for a class that i renamed already and i refractored it the right way but for some reason the error is still pointing to a non-existing class
Edit
My bad lol its still written in the manifest lmao
In my case I removed apply plugin: 'kotlin-android' from gradle file by mistake.
Hi guys,
In my case, it started after I moved my project to Androidx. So, that is the solution for me:
1) Keep multidex version lower. I was using 2.0.1 but it was still crashing. So I switched to 1.0.3
implementation 'com.android.support:multidex:1.0.3'
2) Keep your application super class as MultiDexApplication
public class App extends MultiDexApplication {
That's it. I hope it will help people who are still having this issue.
@lognaturel @srsudar How can I do this on dynamic feature?
Most helpful comment
This sounds a lot like a MultiDex issue I saw with a Collect port I was working on. I solved it by adding a call to
attachBaseContextin the Application class. See the line here.Apologies if this discussion is happening against a branch where this is already added. I don't see it on master. The main fix is this:
edit: Added some much needed context.