【问题标题】:core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not foundcore-1.7.0/res/values/values.xml:105:5-114:25: AAPT: 错误: 资源 android:attr/lStar 未找到
【发布时间】: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

【问题讨论】:

    标签: android flutter


    【解决方案1】:

    使用来自 here 的答案将 compileSdkVersion 和 targetSdkVersion 更新为 31

    并在你的 android/build.gradle 文件最后添加这段代码 sn-p。

    configurations.all {
      resolutionStrategy {
        force 'androidx.core:core-ktx:1.6.0'
    }}
    

    就在最近,audioplayers 包的原作者在他最近的 PR 中修复了这个问题。它已在音频播放器版本 0.20.1 中修复,因此如果您的问题与音频播放器有关,请升级。来自here

    【讨论】:

      【解决方案2】:

      您在问题中收到以下错误消息:

      FAILURE:构建失败并出现异常。
      
      * 什么地方出了错:
      任务 ':audioplayers:compileDebugKotlin' 执行失败。

      删除音频播放器:^0.18.2 插件。升级插件解决不了这个问题。

      【讨论】:

        猜你喜欢
        • 2022-07-02
        • 2022-01-11
        • 2021-12-11
        • 2021-07-11
        • 2023-01-27
        • 2019-01-29
        • 2019-12-26
        • 2019-05-01
        相关资源
        最近更新 更多