Skip to content

Android 14 Splash screen crash #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Fouzhan21 opened this issue Sep 24, 2024 · 2 comments
Open

Android 14 Splash screen crash #653

Fouzhan21 opened this issue Sep 24, 2024 · 2 comments

Comments

@Fouzhan21
Copy link

Fouzhan21 commented Sep 24, 2024

I use React Native version 0.75.2 and have implemented a react-native-splash-screen for local device development. On devices running Android 11, everything works fine. However, when testing on Android 14 during development, the app crashes with an error message after the splash screen appears and I click a button.

And this is the MainActivity.kt file code

package com.tenkan

import android.os.Bundle;
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import org.devio.rn.splashscreen.SplashScreen

class MainActivity : ReactActivity() {

  /**
   * Returns the name of the main component registered from JavaScript. This is used to schedule
   * rendering of the component.
   */
  override fun getMainComponentName(): String = "tenkan"
 override fun onCreate(savedInstanceState: Bundle?) {
    SplashScreen.show(this)
    super.onCreate(savedInstanceState)
}

  /**
   * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
   * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
   */
  override fun createReactActivityDelegate(): ReactActivityDelegate =
      DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}

launch_screen.xml code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:src="@drawable/screen" 
        android:scaleType="centerCrop" 
        /> 

</RelativeLayout>
@Fouzhan21
Copy link
Author

Media (8)

@jagnesh
Copy link

jagnesh commented Feb 24, 2025

🚀 Consider Using react-native-splash-view Instead!

Hey there! 👋 If you're facing issues with AppDelegate changes in React Native 0.76+, you might want to try [react-native-splash-view] instead!

Why switch to react-native-splash-view?

  • Fully compatible with React Native 0.76+, including Swift-based AppDelegate.
  • No extra hassle—works smoothly with both Objective-C & Swift projects.
  • Simple integration with iOS storyboard splash screens & Android launch screens.
  • Lightweight & actively maintained for the latest React Native versions.

Check it out & give it a try! 🚀✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants