APP端

关于广播报 RuntimeException : Didn

2019-04-01  本文已影响0人  我们都很努力着

RuntimeException DexPathList ContentProvider

起因

项目升级了 compileSdkVersion版本从22 ->28 还有 *com.android.support. ** 等包

然后在低版本报错 如下

E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to get provider me.jessyan.autosize.InitProvider: java.lang.ClassNotFoundException: Didn't find class "me.jessyan.autosize.InitProvider" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/2.apk"],nativeLibraryDirectories=[/data/app-lib/2, /vendor/lib, /system/lib, /system/lib/egl]]
        at android.app.ActivityThread.installProvider(ActivityThread.java:4882)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4485)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
        at android.app.ActivityThread.access$1300(ActivityThread.java:141)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5103)
        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:773)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:589)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "me.jessyan.autosize.InitProvider" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/2.apk"],nativeLibraryDirectories=[/data/app-lib/2, /vendor/lib, /system/lib, /system/lib/egl]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
        at android.app.ActivityThread.installProvider(ActivityThread.java:4867)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4485) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425) 
        at android.app.ActivityThread.access$1300(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        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:773) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:589) 
        at dalvik.system.NativeStart.main(Native Method) 

原因 multiDex 的问题

解决方式

1、在dependencies中增加

api 'com.android.support:multidex:1.0.2@aar'

2、在Application中增加

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

重新build 运行即可。

上一篇下一篇

猜你喜欢

热点阅读