Closed lalitkumarext closed 2 years ago
This is still happening
@Benzer1406 Not if you follow the README
@zoontek I did followed the readme and put the code as it is in the MainActivity.java
, doesn't work. Throws this error of "Theme.AppCompat...."
Readme says this:
public class MainActivity extends ReactActivity {
// …
public static class MainActivityDelegate extends ReactActivityDelegate {
// …
@Override
protected void loadApp(String appKey) {
RNBootSplash.init(getPlainActivity()); // <- initialize the splash screen
super.loadApp(appKey);
}
}
}
I put this and it works:
public class MainActivity extends ReactActivity {
//...
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
ReactRootView reactRootView = new ReactRootView(getContext());
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView;
}
@Override
protected void loadApp(String appKey) {
RNBootSplash.init(getPlainActivity());
super.loadApp(appKey);
}
};
}
}
@Benzer1406 Directly under the setup title, you have:
For react-native < 0.68 setup, follow the v4.1.3 README.md (it will works with the latest react-native-bootsplash version too).
MainActivity.java
MainActivity.java
Maybe it's a mismatch between the versions? Everything seems fine here.
@zoontek That is great! Thank you. Indeed I haven't seen that. Should be way bigger, but thanks!
Bug summary
Unable to start activity ComponentInfo{com.example.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3827) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4003) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8595) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:846) at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:809) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:687) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:201) at com.facebook.react.ReactActivityDelegate.loadApp(ReactActivityDelegate.java:92) at com.facebook.react.ReactActivityDelegate.onCreate(ReactActivityDelegate.java:86) at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:46) at com.example.MainActivity.onCreate(MainActivity.java:24) at android.app.Activity.performCreate(Activity.java:8207) at android.app.Activity.performCreate(Activity.java:8191) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3800) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4003) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8595) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Library version
4.1.6
Environment info
Steps to reproduce
Reproducible sample code