且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java.lang.ClassNotFoundException:在路径上找不到类:DexPathList,更新sdk后

更新时间:2022-01-25 19:16:34

编写一个类 EnableMultiDex 如下所示

Write a class EnableMultiDex like below

public class EnableMultiDex extends MultiDexApplication {
    private static EnableMultiDex enableMultiDex;
    public static Context context;

    public EnableMultiDex(){
        enableMultiDex=this;
    }

    public static EnableMultiDex getEnableMultiDexApp() {
        return enableMultiDex;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();

    }
}

并在AndroidManifest.xml中在Application标签中编写这个类

and in AndroidManifest.xml write this class inside Application tag

 <application
    android:name="YourPakageName.EnableMultiDex"
    android:hardwareAccelerated="true"
    android:icon="@drawable/launch_logo"
    android:label="@string/app_name"
    android:largeHeap="true"
    tools:node="replace">