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

照着第二版第一行代码敲的调用摄像头部分,因为编译器提示没有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>

可以

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值