首页 > 解决方案 > 颤振位置包在构建项目中有错误

问题描述

我将位置包添加到项目的 pubspec.yamel 中,当我构建项目时出现此错误:

FAILURE:构建失败并出现异常。

出了什么问题:任务“:app:processDebugResources”执行失败。执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade Android 资源链接失败时发生故障 G:\flutterproject\green_doctor\marketer\marketer\build\location\intermediates\library_manifest\debug\AndroidManifest.xml:11 :9-15:56:AAPT:错误:找不到属性 android:foregroundServiceType。

尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

在https://help.gradle.org获得更多帮助

BUILD FAILED in 55s 构建失败可能是由于插件中的 AndroidX 不兼容。该工具即将尝试使用Jetfier解决不兼容问题。构建插件位置... 运行 Gradle 任务 'assembleAarRelease'... √ 构建 build\app\outputs\repo。构建插件 location_web... 运行 Gradle 任务 'assembleAarRelease'...

F:\flutter.pub-cache\hosted\pub.dartlang.org\location_web-1.0.1\android\src\main\java\com\lyokone\location_web\LocationWebPlugin.java:3: 错误:找不到符号导入 androidx .annotation.NonNull; ^ 符号:类 NonNull 位置:包 androidx.annotation F:\flutter.pub-cache\hosted\pub.dartlang.org\location_web-1.0.1\android\src\main\java\com\lyokone\location_web\LocationWebPlugin。 java:15: 错误:找不到符号 public void onAttachedToEngine(@nonnull FlutterPluginBinding flutterPluginBinding) { } ^ 符号:类 NonNull 位置:类 LocationWebPlugin F:\flutter.pub-cache\hosted\pub.dartlang.org\location_web-1.0。 1\android\src\main\java\com\lyokone\location_web\LocationWebPlugin.java:20: 错误:找不到符号 public void onDetachedFromEngine(@nonnull FlutterPluginBinding binding) { } ^ 符号:类 NonNull 位置:

FAILURE:构建失败并出现异常。

出了什么问题:任务“:compileReleaseJavaWithJavac”执行失败。编译失败;有关详细信息,请参阅编译器错误输出。

尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

在https://help.gradle.org获得更多帮助

11 秒内构建失败

例外:由于上述问题,无法构建插件 location_web。

有人可以帮我解决这个问题吗?

标签: androidflutterdart

解决方案


尝试在 gradle 属性中设置 jetifier

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

推荐阅读