0
votes

I would like to create a splash screen in my React Native app (not Expo) using Android Studio's emulator.

I was trying to add a splash_screen.xml file into android/app/src/main/res/drawable folder. When I put a new .xml file into the android folder the React compiler shows the following error message:

iMac:newtest Dora$ react-native run-android JS server already running. Building and installing the app on the device (cd android && ./gradlew installDebug)...

Configure project :app WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Task :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mergeDebugResources'.

    com.android.build.gradle.tasks.ResourceException (no error message)

  • 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 2s 9 actionable tasks: 1 executed, 8 up-to-date Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html

Command failed: ./gradlew installDebug

Error: Command failed: ./gradlew installDebug at checkExecSyncError (child_process.js:637:11) at Object.execFileSync (child_process.js:655:13) at runOnAllDevices (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19) at buildAndRun (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12) at isPackagerRunning.then.result (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12) at processTicksAndRejections (internal/process/next_tick.js:81:5)

Thank you for taking your time to help me to solve this issue!

Cheers, Alex

1
Maybe if you try to update the version of Android SDK Build Tools it'll fix the issue, I do it in the console of Android Studio when it builds - David Vittori

1 Answers

2
votes

Well, finally I have managed to solve this issue. It is for those who will encounter this problem during Android development.

So, what i did exactly: 1. cd into android folder and run this: ./gradlew installDebug After this command finished without any errors

  1. go back to the root directory and start the app using: react-native run-android

Conclusion, if you add or change any xml files in android folder, you have to do the above procedure.

That's all!

Alex