I’ve got the very same error, using Android Studio Canary.
It returns the same error in Gradle 4.2.1 and Gradle latest version 7.1.0-alpha09. (i.e. error log is bellow)
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)
Furthermore, I’ve updated:
- SDK Platform to Android 12(S).
- Plus SDK Build Tools is updated to Android SDK Build-Tools 31
Where/How must I implement those style attributes?
I’ve added the following items to Styles.xml
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowSplashScreenBackground">@drawable/splash</item>
<item name="android:windowSplashScreenAnimatedIcon">@null</item>
2
Answers
I did change theme parent within AndroidManifest.xml.
After a long time debugging and burning neurons, I switched to another react-native pluggin called bootsplash. https://www.reactnativeschool.com/simple-splash-launch-boot-screen-in-react-native-ios-and-android
It seems react-native-splashscreen's core (i.e. latest version 3.2.0) has a bug within JAVA's native source code.
Best wishes, I
Most probably a duplicate of my question
I guess you didn’t change the theme parent.
With the latest update, Android 12 comes with
SplashScreen API
to ensure the splash screen displays correctly starting in Android 12.To access that you have to upgrade your gradle file and change your theme parent to
Theme.SplashScreen
. In your gradle add:Create a separate
style.xml
for the splash screenSet the theme in your manifest
<application>
Finally in
MainActivity
or your start activity to load the splash screen set this inonCreate()
beforesetContentView()