how to fix the issue of Missing ‘package‘ key attribute on element package

After got that failed log ,I try to find the grade version and find the below explanantion,in  url https://developer.android.google.cn/studio/releases/gradle-plugin

本次要更新支持与 Android 11 中软件包可见性的新默认设置和功能兼容。

在以前的 Android 版本中,可以查看设备上安装的所有应用的列表。从 Android 11(API 级别 30)开始,默认情况下,应用只能访问经过过滤的已安装软件包列表。如需查看系统上更广泛的应用列表,您现在需要在应用或库的 Android 清单中添加 <queries> 元素

Android Gradle 插件 4.1 及更高版本已与新的 <queries> 声明兼容;不过,较低的版本不兼容。如果您添加 <queries> 元素或者开始依赖于支持以 Android 11 为目标平台的库或 SDK,在构建应用时可能会遇到清单合并错误。

为了解决此问题,我们将针对 AGP 3.

如果您使用的是
AGP 版本...
...请升级到
4.0.*4.0.1
3.6.*3.6.4
3.5.*3.5.4
3.4.*3.4.3
3.3.*3.3.3

3 及更高版本发布一组补丁程序。如果您使用的是旧版 AGP,升级到以下某个版本

so try to fix the issue, you can modify the grade version,

for the right side grade version, it would fix the failed grade issue。

 

Ex: 

 I just use the Android studio 3.5.2, I just change 

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.4'  //old version is 3.5.2
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

in the build.gradle file

after modify the file and sync it again, then Android studio work normanly!

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值