栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

targetSdkVersion升到31后,编译提示需要android:exported

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

targetSdkVersion升到31后,编译提示需要android:exported

最近要上架google,要求编译版本最低是30。我想着那就一步到位弄到31吧。

结果报错

/Users/erone/项目/xxx For Google/app/src/main/AndroidManifest.xml Error:
	android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
/Users/erone/项目/xxx For Google/app/src/main/AndroidManifest.xml Error:
	android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
/Users/erone/项目/xxx For Google/app/src/main/AndroidManifest.xml Error:
	android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

先搜了一下,说是android12以上manifest里所有activity都要加上android:exported描述。问题是我已经加上了,manifest里的四大组件都有了这个描述

再搜了搜发现是依赖库的问题https://stackoverflow.com/questions/67654506/manifest-merger-failed-targeting-android-12/67668116#67668116

大概意思,检查一下以androidx.test为前缀的依赖是不是最新版本,如果不是升级一下应该就没问题了。我这里包括以下三个

androidx.test:runner
androidx.test.espresso:espresso-core
androidx.test.ext:junit

版本太低,升级下版本就可以了。

要升一起升,要死一起死,难受啊~~

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/732629.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号