Jonathan James
Jonathan James

Reputation: 31

Unknown error: Didn't find class on path: DexPathList

My application has recently crashed and will not work no matter what I change. It was working completely fine earlier however I must have made a mistake refactoring some variables/classes. The error returned from the LOGCAT mentions a class NotifyStart that I have never used or implemented in my project so I do not know where this has came from. I have included the error returned from the LOGCAT below.

I have tried cleaning and rebuilding as well as disabling the instant run feature for this project but nothing has worked so far. The application will not start whatsoever and crashes before the Home activity has a chance to pop up.


2019-07-24 20:38:57.065 27709-27709/com.example.camerakitqr E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.camerakitqr, PID: 27709
    java.lang.RuntimeException: Unable to instantiate application com.example.camerakitqr.NotifiyStart: java.lang.ClassNotFoundException: Didn't find class "com.example.camerakitqr.NotifiyStart" on path: DexPathList[[zip file "/data/app/com.example.camerakitqr-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.camerakitqr-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64]]
        at android.app.LoadedApk.makeApplication(LoadedApk.java:807)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5477)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:203)
        at android.app.ActivityThread.main(ActivityThread.java:6251)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.camerakitqr.NotifiyStart" on path: DexPathList[[zip file "/data/app/com.example.camerakitqr-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.camerakitqr-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64]]
        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 android.app.Instrumentation.newApplication(Instrumentation.java:992)
        at android.app.LoadedApk.makeApplication(LoadedApk.java:801)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5477) 
        at android.app.ActivityThread.-wrap2(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595) 
        at android.os.Handler.dispatchMessage(Handler.java:110) 
        at android.os.Looper.loop(Looper.java:203) 
        at android.app.ActivityThread.main(ActivityThread.java:6251) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
 

Upvotes: 0

Views: 1005

Answers (1)

Mahmoud Waked
Mahmoud Waked

Reputation: 395

You have to enable multidex for apps with over 64K methods.

Modify your build.gradle:

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14 //lower than 14 doesn't support multidex
             targetSdkVersion 22

             // Enabling multidex support.
             multiDexEnabled true
         }
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'
}

If you are running unit tests, you will want to include this in your Application class:

public class YouApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}

Or just make your application class extend MultiDexApplication

public class Application extends MultiDexApplication {

}

Note: Android 5.0 (API level 21) and higher uses ART which natively supports multidexing. Therefore, if your minSdkVersion is 21 or higher, the multidex support library is not needed.

Upvotes: 2

Related Questions