java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/***.apk"],nativeLibraryDirectories=[/data/app-lib/***-1, /vendor/lib, /system/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:4892) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4484) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4424) at android.app.ActivityThread.access$1500(ActivityThread.java:143) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5120) 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:818) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/***-1.apk"],nativeLibraryDirectories=[/data/app-lib/***-1, /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:4877) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4484) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4424) at android.app.ActivityThread.access$1500(ActivityThread.java:143) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5120) at java.lang.reflect.Method.invokeNative(Native Method)
1)首先修改Gradle配置文件,启用MultiDex并包含MultiDex支持:
defaultConfig { multiDexEnabled true }
在Application中重写attachBaseContext方法
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(base); }
问题解决