java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.me.hexavoidaa/com.me.hexavoidaa.PTPlayer}: java.lang.ClassNotFoundException: Didn't find class "com.me.hexavoidaa.PTPlayer" on path: DexPathList[[zip file "/data/app/com.me.hexavoidaa-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.me.hexavoidaa-1, /vendor/lib, /system/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2340)
    at android.app.ActivityThread.access$800(ActivityThread.java:157)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:157)
    at android.app.ActivityThread.main(ActivityThread.java:5293)
    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:1265)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.me.hexavoidaa.PTPlayer" on path: DexPathList[[zip file "/data/app/com.me.hexavoidaa-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.me.hexavoidaa-1, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
    ... 11 more
            Asked
            
        
        
            Active
            
        
            Viewed 2.1k times
        
    23
            
            
        
        OneCricketeer
        
- 179,855
 - 19
 - 132
 - 245
 
        Joel
        
- 241
 - 1
 - 2
 - 3
 
- 
                    Maybe problem with multidex implementation, refer [Documentation](https://developer.android.com/studio/build/multidex.html) – Akshay Bhat 'AB' Jan 02 '17 at 12:34
 - 
                    1Have you added the activity to the manifest? – Jemil Riahi Jan 02 '17 at 12:35
 - 
                    I suggest you look here for some possible solutions: http://stackoverflow.com/questions/22399572/java-lang-classnotfoundexception-didnt-find-class-on-path-dexpathlist – yakobom Jan 02 '17 at 12:37
 - 
                    did you add PTPlayer class in manifest ? – Manohar Jan 02 '17 at 12:40
 - 
                    1same problem here. Have no idea... guys explain why downvotes? – LPVOID Jul 13 '17 at 05:39
 - 
                    I have the exact same issue and my apk does not require multidex (APK analyzer shows that the referenced methods are below 64K). Any ideas? – steliosf Aug 08 '17 at 16:23
 - 
                    Seeing this issue surface in logs, unable to reproduce. Have Multidex implemented properly. – AlexVPerl Sep 21 '19 at 18:56
 
5 Answers
4
            
            
        add this to gradle.build:
defaultConfig {
...
minSdkVersion 14
targetSdkVersion // your version 
...
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
  compile 'com.android.support:multidex:1.0.0'
}
- follow android developers page's instruction: https://developer.android.com/studio/build/multidex.html
 
        OneCricketeer
        
- 179,855
 - 19
 - 132
 - 245
 
        Ranjith KP
        
- 858
 - 6
 - 18
 
- 
                    3I have a very small app and yet still have this issue: https://play.google.com/store/apps/details?id=com.lb.app_manager . Do you think I should enable multiDex? I noticed it occurs (for now) only on Android 5.1 and below, yet the docs say that it shouldn't occur on Android 5.0 and above... – android developer May 29 '17 at 17:41
 - 
                    @androiddeveloper I'm having the exact same issue with devices running Android 5.1 and below. Did you manage to solve the issue? – steliosf Aug 08 '17 at 16:01
 - 
                    1
 
3
            
            
        In Android 9 likely to help adding to manifest into "application" tag:
<uses-library
        android:name="org.apache.http.legacy"
        android:required="false" />
        AlexS
        
- 918
 - 1
 - 12
 - 28
 
2
            
            
        In some cases, this could be a MultiDex issue. Try this in your application class. That is in App.java which extends Application:
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this); // this is the key code
}
        kc ochibili
        
- 3,103
 - 2
 - 25
 - 25
 
- 
                    2
 - 
                    this only needed if your App class already extends some other class and you can't extend from MultiDexApplication – Kirill Karmazin Jun 08 '18 at 12:01
 
1
            
            
        if you already added multidex in both gradle and manifest then try to disable instant run and then create apk to test, i was facing same issue and searched a lot and tried every solution but at last this solved my problem
        Muhammad Natiq
        
- 213
 - 5
 - 14
 
1
            
            
        Solved:
Step 1: create MyApp class as follows:
public class MyApp extends Application {
@Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this); // this is the key code
    }
}
Step 2: Add the name property to the app in the manifest as follows:
<application
        android:name=".MyApplication">
        Basil Rawa
        
- 109
 - 1
 - 5