我遇到了同样的错误,使用的是Android Studio Canary。
在Gradle 4.2.1和最新版本的Gradle 7.1.0-alpha09中都返回相同的错误。(即下面的错误日志)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
ERROR:/home/iuri/QonteoApps/biometricmax/node_modules/react-native-splash-screen/android/build/intermediates/packaged_res/release/values/values.xml:13:5-18:13: AAPT: error: style attribute 'android:attr/windowSplashScreenBackground' not found.
ERROR:/home/iuri/QonteoApps/biometricmax/node_modules/react-native-splash-screen/android/build/intermediates/packaged_res/release/values/values.xml:13:5-18:13: AAPT: error: style attribute 'android:attr/windowSplashScreenAnimatedIcon' not found.
ERROR:/home/iuri/.gradle/caches/transforms-3/de2ed04f8522efd4ca22835ece62dd33/transformed/core-splashscreen-1.0.0-alpha01/res/values-v31/values-v31.xml:3:5-9:13: AAPT: error: style attribute 'android:attr/windowSplashScreenAnimatedIcon' not found.
ERROR:/home/iuri/.gradle/caches/transforms-3/de2ed04f8522efd4ca22835ece62dd33/transformed/core-splashscreen-1.0.0-alpha01/res/values-v31/values-v31.xml:3:5-9:13: AAPT: error: style attribute 'android:attr/windowSplashScreenBackground' not found.
ERROR:/home/iuri/.gradle/caches/transforms-3/de2ed04f8522efd4ca22835ece62dd33/transformed/core-splashscreen-1.0.0-alpha01/res/values-v31/values-v31.xml:3:5-9:13: AAPT: error: style attribute 'android:attr/windowSplashScreenAnimationDuration' not found.
at com.android.builder.internal.aapt.v2.Aapt2Exception$Companion.create(Aapt2Exception.kt:45)
at com.android.builder.internal.aapt.v2.Aapt2Exception$Companion.create$default(Aapt2Exception.kt:39)
此外,我已更新:
- SDK平台为Android 12(S)。
- Plus SDK构建工具已更新为Android SDK Build-Tools 31。
在哪里/如何实现这些样式属性? 我已将以下项目添加到Styles.xml中。
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowSplashScreenBackground">@drawable/splash</item>
<item name="android:windowSplashScreenAnimatedIcon">@null</item>