我开发的一个Flutter Android应用今天突然编译错误。
错误:
任务“: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未找到。
错误:链接引用失败。
使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
构建在 16 秒内失败。
运行我的本机代码时react-native run-android出现错误。它工作正常。但是在从 git 中获取新的 pullnpm ci并且在我运行之后然后收到这个错误。
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.core:core:1.7.0-alpha01.
AAR metadata file: C:\Users\gauraab\.gradle\caches\transforms-2\files-2.1\9e02d64f5889006a671d0a7165c73e72\core-1.7.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.
Run Code Online (Sandbox Code Playgroud) 在我们将compileSdkVersion和targetSdkVersion升级到31之后,这种情况开始发生。
提供一些背景信息:我们的项目目前使用的是 React Native 0.63.2,之前的compileSdkVersion 是 30。几天前我们一直在成功构建 Android 应用程序,但突然开始失败,并出现以下错误:
AAPT: error: resource android:attr/lStar not found
Run Code Online (Sandbox Code Playgroud)
经过一番网上搜索,我们在这里找到了一些解决方案:资源链接在 lStar 上失败 。我们升级到compileSdkVersion和targetSdkVersion到31,做了一些其他相关的更改并且能够成功编译。但现在,当我在 Android 13 设备上运行该应用程序时,该应用程序在启动时立即崩溃。以下是logcat的错误日志:
2022-11-06 16:54:44.438 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found: needed by /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libjscexecutor.so in namespace classloader-namespace result: 0
2022-11-06 16:54:44.480 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZTVN6hermes2vm12CrashManagerE" referenced by "/data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libhermes-executor-debug.so"... result: 0
2022-11-06 16:54:44.482 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to …Run Code Online (Sandbox Code Playgroud) 当我对始终运行良好的发布变体执行测试时,我开始遇到错误。代码始终在 Docker 容器中执行,因此我们可以确保构建始终是干净的。
今天出于某种原因,代码没有任何更改,我开始在测试运行中看到错误:
Execution failed for task:
am:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/.gradle/caches/transforms-2/files-2.1/ff28653768e2ccb1135467db3600af3a/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
Run Code Online (Sandbox Code Playgroud)
我对该错误进行了一些研究,但我只发现了与另一个资源相关的错误,而没有发现与 lStar 相关的错误。到目前为止,我发现 lStar 是特别添加到 Android 31(Android 12)的代码,如果我的 compileSdkVersion 值为 28,这对我来说为什么它应该开始在 Android 12 上工作毫无意义。
<declare-styleable name="ColorStateListItem">
<!-- Base color for this state. -->
<attr name="android:color"/>
<!-- Alpha multiplier applied to the base color. -->
<attr format="float" name="alpha"/>
<attr name="android:alpha"/>
<!-- Perceptual luminance applied to the base color. From 0 to 100. --> …Run Code Online (Sandbox Code Playgroud)