欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

java.lang.RuntimeException: Unable to get provider android.provider.DocumentsProvider: java.lang.Ins

程序员文章站 2022-04-27 11:43:16
照着第二版第一行代码敲的调用摄像头部分,因为编译器提示没有android.support.v4.content.fileprovider。就自己导了一个名字带provider的android.provider.DocumentsProvider报错信息如下:E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.cameraalbumtest, PID: 13140 java.lang.RuntimeExcep...

照着第二版第一行代码敲的调用摄像头部分,因为编译器提示没有android.support.v4.content.fileprovider。就自己导了一个名字带provider的

android.provider.DocumentsProvider

报错信息如下:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.cameraalbumtest, PID: 13140
    java.lang.RuntimeException: Unable to get provider android.provider.DocumentsProvider: java.lang.InstantiationException: java.lang.Class<android.provider.DocumentsProvider> cannot be instantiated
        at android.app.ActivityThread.installProvider(ActivityThread.java:7400)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6917)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6823)
        at android.app.ActivityThread.access$1400(ActivityThread.java:255)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2089)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:230)
        at android.app.ActivityThread.main(ActivityThread.java:7768)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:508)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
     Caused by: java.lang.InstantiationException: java.lang.Class<android.provider.DocumentsProvider> cannot be instantiated
        at java.lang.Class.newInstance(Native Method)
        at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
        at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:60)
        at android.app.ActivityThread.installProvider(ActivityThread.java:7384)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6917) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6823) 
        at android.app.ActivityThread.access$1400(ActivityThread.java:255) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2089) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:230) 
        at android.app.ActivityThread.main(ActivityThread.java:7768) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:508) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034) 
<provider
            android:authorities="${applicationId}.fileprovider"
            android:name="androidx.core.content.FileProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"/>
        </provider>

可以

本文地址:https://blog.csdn.net/fuckingone/article/details/107488765

相关标签: android