在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>