question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

White screen still showing on android

See original GitHub issue

Following the steps for android setup still led to a white screen. Below are concerned files:

“pod”: “^0.9.0”, “react”: “16.9.0”, “react-native”: “0.61.5”, “react-native-splash-screen”: “^3.2.0”,

Android Manifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.solvicles">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/> <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
    <activity
        android:name=".SplashActivity"
        android:theme="@style/SplashTheme"
        android:label="@string/app_name"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize"
      android:exported="true">
      <!-- android:screenOrientation="portrait" -->
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

Java files:

MainActivity:


package com.solvicles;

import android.os.Bundle;

import com.facebook.react.ReactActivity;

import org.devio.rn.splashscreen.SplashScreen
;

public class MainActivity extends ReactActivity {
  @Override

  protected void onCreate(Bundle savedInstanceState){
    SplashScreen.show(this);
    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 "Solvicles";
  }
}

MainApplication:

package com.solvicles;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import org.reactnative.maskedview.RNCMaskedViewPackage;
import com.BV.LinearGradient.LinearGradientPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost =
      new ReactNativeHost(this) {
        @Override
        public boolean getUseDeveloperSupport() {
          return BuildConfig.DEBUG;
        }

        @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          // packages.add(new MyReactNativePackage());
          return packages;
        }

        @Override
        protected String getJSMainModuleName() {
          return "index";
        }
      };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
    initializeFlipper(this); // Remove this line if you don't want Flipper enabled
  }

  /**
   * Loads Flipper in React Native templates.
   *
   * @param context
   */
  private static void initializeFlipper(Context context) {
    if (BuildConfig.DEBUG) {
      try {
        /*
         We use reflection here to pick up the class that initializes Flipper,
        since Flipper library is not available in release mode
        */
        Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
        aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (NoSuchMethodException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
}

SplashActivity:

package com.solvicles;

        import android.content.Intent;
        import android.os.Bundle;

        import androidx.appcompat.app.AppCompatActivity;

public class SplashActivity extends AppCompatActivity {
    @Override

    protected void onCreate(Bundle saveInstanceState){
        super.onCreate(saveInstanceState);

        Intent intent= new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();

    }
}

XML files:

background_splash.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@color/black"/>
    <item
        android:width="150dp"
        android:height="200dp"
        android:drawable="@mipmap/logo"
        android:gravity="center"
        />

</layer-list>


font.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@color/black"/>
    <item
        android:width="150dp"
        android:height="200dp"
        android:drawable="@mipmap/logo"
        android:gravity="center"
        />

</layer-list>


launch_screen.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    android:gravity="center">

    <ImageView
        android:layout_width="300dp"
        android:layout_height="400dp"
        android:src="@mipmap/logo" />

    <TextView
        android:layout_width="184dp"
        android:layout_height="wrap_content"
        android:fontFamily="@font/font"
        android:fontWeight="200"
        android:paddingLeft="35dp"

        android:paddingTop="100dp"
        android:text="Solvicles"
        android:textColor="#FFFFFF"
        android:textSize="27sp"></TextView>

</LinearLayout>

colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="black" >#000000</color>
    <color name="primary_dark" >#000000</color>


</resources>

strings.xml:

<resources>
    <string name="app_name">Solvicles</string>
</resources>



styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:textColor">#000000</item>
    </style>

    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:windowBackground">@drawable/background_splash</item>

    </style>
</resources>

The icon name on mipmap is logo

App.js:

i``` mport React, {Component} from ‘react’; import { SafeAreaView, StyleSheet, ScrollView, View, Text, StatusBar, Image, TouchableOpacity, Platform

} from ‘react-native’; import LinearGradient from ‘react-native-linear-gradient’; import Omni from ‘./Omni.js’ import { observer } from “mobx-react” import RNSplashScreen from ‘react-native-splash-screen’

@observer class App extends React.Component{

componentDidMount(){ RNSplashScreen.hide() StatusBar.setHidden(true, ‘none’)

}

render(){

return(

<Omni/>

) } }

export default App;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
ohhyunjincommented, Feb 21, 2020

Okay, I solved it: Screen Shot 2020-02-21 at 15 40 30

So as you can see, after SplashScreen.hide() I’m manually navigating to another screen (which in my case is the login screen). This solved the problem of the white screen still showing on Android. Also, the reason why I have that render() and just rendering an empty view is that without it, the app was crashing. Hope this helps!

0reactions
ohhyunjincommented, Feb 25, 2020

Oh great! Glad to hear that your problem has been fixed! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix Android White Screen of Death on Samsung Devices
If your Android screen turned white all of a sudden and your terminal has become unusable, force restart the device. Additionally, remove your ......
Read more >
Fixing Android White Screen of Death - 5 Easy Solutions
How Do You Fix Android White Screen of Death? · Solution 1: Force Reboot Android Phone · Solution 2: Remove Your Battery ·...
Read more >
Easy Ways to Fix White Screen of Death on Android Phones ...
1. Fix white screen of death by Rebooting or Restoring Factory Settings · 2. Clear App Data and Cache, then uninstall the unnecessary...
Read more >
[Solved] How To Fix Android White Screen of Death (WSOD ...
Recommended Method: Fix Android White Screen of Death Error Automatically. Reboot Your Device. Uninstall Unwanted Apps. Clear App Data and ...
Read more >
[SOLVED] 8 Ways To Fix White Screen Of Death On Android ...
Why My Android Phone Showing White Screen? · The phone is dropped from a height and has got internal damage · Some files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found