错误信息如下
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /Users/lhz/Documents/AndroidProject/hb_unicom_flutter/.android/Flutter/build/intermediates/flutter/debug/libs.jar.
> Transform's input file does not exist: /Users/lhz/Documents/AndroidProject/hb_unicom_flutter/.android/Flutter/build/intermediates/flutter/debug/libs.jar. (See https://issuetracker.google.com/issues/158753935)
这个问题的解决方法就在链接https://issuetracker.google.com/issues/158753935 中,需要翻墙访问。
结论就是这是构建时的一个BUG,Google应该会在新版本gradle中修复,现在的解决方法就是:
- 如果错误信息中是提示缺少 debug/libs.jar, 先执行flutter run --debug 成功后,再执行打包操作即可。
- 如果错误信息中是提示缺少 profile/libs.jar, 先执行flutter run --profile 成功后,再执行打包操作即可。
其实就是通过执行相应命令,生产缺少的jar文件。