【发布时间】:2022-01-06 00:12:29
【问题描述】:
我的项目基础是在 Flutter 1.0 上开发的。当升级到 2.0 并更新代码、插件和其他东西时,它可以运行正常,但现在我从 Flutter 2.0 升级到 2.5 时出现错误。我无法解决我的项目错误。然后尝试用this post 解决,但没有成功。
控制台错误:
在为 x86 构建的 Android SDK 上以调试模式启动 lib/main.dart... 正在运行 Gradle 任务 'assembleDebug'...
FAILURE:构建失败并出现异常。
- 出了什么问题:任务“:app:processDebugResources”执行失败。
执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Android资源链接失败 /home/jui/.gradle/caches/transforms-2/files-2.1/ab231ee2f2fa8dc93f62d941a01ead4b/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT:错误:找不到资源 android:attr/lStar。
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
在 21 秒内构建失败异常:Gradle 任务 assembleDebug 失败 退出代码 1
我更新了 android/app/build.gradle compileSdkVersion 31、targetSdkVersion 31 并更新了 android/build.gradle
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}
通过添加行尾,但出现新错误:
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: /home/jui/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.5.31/43331609c7de811fed085e0dfd150874b157c32/kotlin-stdlib-common-1.5.31.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
.
.
.
.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioplayers:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1
【问题讨论】: