为了适配Android 11,主要是Android 11 管理软件包可见性,具体参考 Android 开发文档 管理软件包可见性https://developer.android.google.cn/training/basics/intents/package-visibility?hl=en
我只是修改了 gradle/wrapper/gradle-wrapper.properties 中的 gradle 版本,为7.0.2,如下distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
编译出错如下,不多说上代码
1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':app:checkHuaweiDebugManifest' (type 'CheckManifest').
- Type 'com.android.build.gradle.internal.tasks.CheckManifest' property 'manifest' has @Input annotation used on property of type 'File'.
Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.
Possible solutions:
1. Annotate with @InputFile for regular files.
2. Annotate with @InputDirectory for directories.
3. If you want to track the path, return File.absolutePath as a String and keep @Input.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.
百度上没有找到相关的报错的资料,后台google 翻墙到 stack overflow 上找到相关的问题,gradle 升级了,要升级相应的 gradle 插件工具,也就是app 的 build.gradle 文件如下:
dependencies { classpath 'com.android.tools.build:gradle:4.2.2' } 之前的是 lasspath 'com.android.tools.build:gradle:3.5.3'
具体参考 stack overflow: android - A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest') in flutter - Stack Overflow
因为适配 Android 11要升级到gradel 版本到 7.0.0以上,gradle 版本升级了 gradle 插件工具也要升级才正常,要不然编译通不过,详细可以参考Android开发文档:
Android Gradle 插件版本说明 | Android 开发者 | Android DevelopersAndroid Studio 构建系统以 Gradle 为基础,并且 Android Gradle 插件添加了几项专用于构建 Android 应用的功能。https://developer.android.google.cn/studio/releases/gradle-plugin#updating-plugin
以上是自己项目上填的坑,简单记录,方便以后查找,如有遇到同样问题的同学也可参考
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)