一、错误描述

最近把一个旧的项目从Eclipse迁移到Android Studio的时候,做适配26,遇到如下错误:

E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.XXl.XXl, PID: 10251

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/com.XXl.XXl-pBXoeCsw74hjKSQpT2YeKA==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXl.XXl-pBXoeCsw74hjKSQpT2YeKA==/lib/x86, /system/lib, /vendor/lib]]

at android.app.ActivityThread.installProvider(ActivityThread.java:6242)

at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)

at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)

at android.app.ActivityThread.-wrap1(Unknown Source:0)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)

at android.os.Handler.dispatchMessage(Handler.java:106)

at android.os.Looper.loop(Looper.java:164)

at android.app.ActivityThread.main(ActivityThread.java:6494)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.XXl.XXl-pBXoeCsw74hjKSQpT2YeKA==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXl.XXl-pBXoeCsw74hjKSQpT2YeKA==/lib/x86, /system/lib, /vendor/lib]]

at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)

at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

at android.app.ActivityThread.installProvider(ActivityThread.java:622

二、原因分析

一、菜单

androidstudio工程文件怎么打开(android.support的FileProvider不存在的解决方法)(1)

二、选择依赖

androidstudio工程文件怎么打开(android.support的FileProvider不存在的解决方法)(2)

三、点击添加库

androidstudio工程文件怎么打开(android.support的FileProvider不存在的解决方法)(3)

四,选择support包

,