在AndroidManifest.xml的application中添加provider時提示unresolved package ‘content’
<provider
<!--
下一行代碼報錯
unresolved package 'content'
-->
android:name="android.support.v4.content.FileProvider"
android:authorities="com.wocus.wine.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
查詢文檔可知,最新的Android標準將android.support.v4.content.FileProvider
替換爲了androidx.core.content.FileProvider
將其更改即可
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.wocus.wine.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>