react-native-splash-screen
react-native-splash-screen copied to clipboard
Error retrieving parent for item: No resource found that matches the given name 'SplashScreen_SplashTheme'.
Getting this error while compiling the application.
<project_path>\android\app\build\intermediates\res\merged\debug\values\values.xml:1388: error: Error retrieving parent for item: No resource found that matches the given name 'SplashScreen_SplashTheme'.
:app:processDebugResources FAILED
FAILURE: Build failed with an exception.
// android/app/src/main/java/com/<project_name>/MainActivity.java
package com.rz_react_native;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import org.devio.rn.splashscreen.SplashScreen;
import com.cboy.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, R.style.SplashScreenTheme); // here
super.onCreate(savedInstanceState);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "<project_name>";
}
}
// android/app/src/main/res/values/color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="mainColor">#066193</color>
<color name="primary_dark">#000000</color>
<color name="white">#ffffff</color>
<color name="status_bar_color">#066193</color>
</resources>
// android/app/src/main/res/values/styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="colorPrimaryDark">@color/status_bar_color</item>
</style>
</resources>
up
this is because you dont have react-native-splash-screen correclty linked in your android build
- Try linking the react-native-splash-screen
react-native link react-native-splash-screen
OR
- This above mentioned command adds the following changes in settings.gradle, so you can manually add these lines to the settings.gradle file
include ':react-native-splash-screen' project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')