Android调用相机时找不到android.support.v4.content.FileProvider unresolved package 'content'

在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>
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 撸撸猫 设计师:C马雯娟 返回首页