Couldn‘t find meta-data for provider with authority

这个原因很简单,妈的,网上没有用太多相关的文章,自己mark一下,这个错误是检查AndroidManifest.xml,里面的

<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="包名.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true"
   >
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths" />
</provider>

尤其注意android:authorities="包名.fileprovider",注意大小写,

把带包名的数据  android:authorities="${applicationId}.fileprovider 

现在10.0读取不到内存卡,需要额外再增加一行代码,别问为什么,只需要ctrl+c和ctrl+v

android:requestLegacyExternalStorage="true"

猜你喜欢

转载自blog.csdn.net/haiyoumeizhuce/article/details/99981936