wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

White screen on every project android build #2883

Closed narek11 closed 6 years ago

narek11 commented 6 years ago

white screen on android

The whole day today I spent trying to build my app on android. But all the builds were successful only blank white screen show up at the end as a result.

I tried to run the example project in this repo, again the same white screen.

I am not sure what is going on or what I am doing wrong.

jahglow commented 6 years ago

Same here, I spent two days fiddling with this white screen trying to understand what was wrong. no luck. React Native 0.53.3 RNN - 1.1.409

No errors or warnings on gradle build, targeted API is 26+ My MainApplication.java is

package com.archer.eurobloha;

import android.app.Application;

import com.oblador.vectoricons.VectorIconsPackage;
import io.invertase.firebase.RNFirebasePackage;
import com.BV.LinearGradient.LinearGradientPackage;
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.reactnativenavigation.NavigationApplication;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends NavigationApplication {

  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new VectorIconsPackage(),
            new LinearGradientPackage(),
            new RNFirebasePackage(),
            new RNFirebaseFirestorePackage()
    );
  }
  @Override
  public String getJSMainModuleName() {
    return "index";
  }

  @Override
  public boolean isDebug() {
    // Make sure you are using BuildConfig from your own application
    return BuildConfig.DEBUG;
  }

  @Override
  public List<ReactPackage> createAdditionalReactPackages() {
    return getPackages();
  }
}
guyca commented 6 years ago

I tried to run the example project in this repo, again the same white screen.

Just npm installed and ran react-native run-android - seems to work fine. I'm closing the issue as it's a duplicate and there's not enough information.

narek11 commented 6 years ago

@guyca why are you closing this?

I am telling you that even the example app brings up white screen and you close this without saying anything?

Give us a project to clone and run that works.

I use genymotion emulator to run them.

narek11 commented 6 years ago

@jahglow I went ahead and tried with RNN v2 and same white screen. Please let me know in case you have any success. I will post my success status updates here for you and people.

Noitidart commented 6 years ago

I am also having this same issue. Steps to reproduce is following the steps from the installation - https://wix.github.io/react-native-navigation/#/installation-android

Except for me. I just kept running react-native run-android and once it did load. Most times its blank.

Noitidart commented 6 years ago

Oh wow I found the solution. It seems its the android debug mode timing bug.

When you see the blank screen on startup in android:

1) hit the "square" button to show all open apps 2) Then press on your app 3) voila it renders

Here is screenshots of steps:

Noitidart commented 6 years ago

This is the bug that was affecting us - https://github.com/wix/react-native-navigation/issues/2180

jaltin commented 6 years ago

I'm also experiencing this white screen issue, and just as @narek11 I wonder why it was closed. Seems people are still experiencing this.

The fix suggested @Noitidart does not work for me. I'm stuck!

Noitidart commented 6 years ago

@jaltin you might have a js error. And also your MainApplication.java should look like this:

package com.wix;

import com.reactnativenavigation.NavigationApplication;

import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends NavigationApplication {

  @Override
  public boolean isDebug() {
    return BuildConfig.DEBUG;
  }

  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(

    );
  }

  @Override
  public List<ReactPackage> createAdditionalReactPackages() {
    return getPackages();
  }

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

}
jaltin commented 6 years ago

Yes you are right about the js error being the problem for me @Noitidart.

I had a look in logcat in Android Studio and there I found warnings that I didn't have any icon for my tabs, just label and title was defined for my tabs.

This works ok in iOS but when trying to run without icons on Android it just gives the blank screen and the JS error. Once I added the icon it works well. banging my head against the keyboard for not spotting this earlier .

Thanks for your help!

Noitidart commented 6 years ago

Thanks for sharing! That's an awesome help! I didn't know about looking at logcat.

felipecoders commented 5 years ago

I resolve this bug by closing and opening the app again within the genymotion

kennedymj97 commented 5 years ago

To fix this I had to run react-native start in a separate terminal and then run react-native run-android.

anunaybiswas commented 5 years ago

@kennedymj97 This worked. But why ? Is there a difference between running from android studio and running this app using react-native run-android ?

sumukhah commented 5 years ago

@kennedymj97 Worked For me ....

ydvnishant001 commented 4 years ago

To fix this I had to run react-native start in a separate terminal and then run react-native run-android.

@kennedymj97 where should i type this in android studio???

adityakmr7 commented 3 years ago

I am facing the same issue, have anyone found any solution for this yet please let me know.