消息“错误:资源 android:attr/lStar 未找到"

消息“错误:资源 android:attr/lStar 未找到

问题描述:

我开发的一个 Flutter Android 应用今天突然编译错误.

A Flutter Android app I developed suddenly compiled wrong today.

错误:

任务:app:processDebugResources"执行失败.

Execution failed for task ':app:processDebugResources'.

Android 资源链接失败/Users/xxx/.gradle/caches/transforms-2/files-2.1/5d04bb4852dc27334fe36f129faf6500/res/values/values.xml:115:5-162:25: AAPT: 错误: 资源 android:attr/lStar 未找到.

Android resource linking failed /Users/xxx/.gradle/caches/transforms-2/files-2.1/5d04bb4852dc27334fe36f129faf6500/res/values/values.xml:115:5-162:25: AAPT: error: resource android:attr/lStar not found.

错误:链接引用失败.

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

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.

构建在 16 秒内失败.

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

Using the answer from here Update compileSdkVersion and targetSdkVersion to 31

并在您的 android/build.gradle 文件的最后添加此代码片段.

And add this code snippet in your android/build.gradle file at the very end.

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

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

Just recently the original author of audioplayers package fixed this issue in his recent PR. It has been fixed in audioplayers version 0.20.1, so if your issue is related to audioplayers, do upgrade.