'React Native white blank screen issue
Always getting white blank screen when running the app on the physical device in android case. Using react-native-navigation
can't able to detect the bug please help!
I have created a fresh react-native
project and integrated the react-native-navigation
library into it and when I am running the app in my physical device by running the command yarn run android
it runs but shows blank white screen in android. Once it runs successfully but now it won't.
Solution 1:[1]
Use "react-native init" command for the creating the project as it only build react-native not expo and the other node modules for you and then build for the particular platforms for eg. in my case "react-native run-android" and it works.
Solution 2:[2]
run react-native start in a separate terminal and then run react-native run-android.
Solution 3:[3]
i recently faced two kind of white screen problem
1.always showing white screen (due to bundling..) solutions is
react-native start
and then
react-native run-android
2.it shows white screen some particular seconds or suddenly always shows white screen in properly working app
due to app cache or traffic
solutions is
Androidmanifest.xml
android:usesCleartextTraffic="true"
Solution 4:[4]
If Debug JS Remotely
is on then also we see the blank screen. I have recently come across this issue. So check if you are already running Debug JS Remotely
. If you are running it already then just stop remote debugging. And it will work.
Solution 5:[5]
Running ./gradlew clean on android folder and then uninstalling the app from the phone worked for me.
Solution 6:[6]
In my case, was using my Phone to test and develop, and suddenly white screen issue appeared.
The app was not loading at all, no error, no code update only white screen comes up after npx react-native run-android.
My solution was to clear the phone cache as it was loading from cache.
I restarted my phone then cleared all cache and then it worked for me.
Solution 7:[7]
There is step-by-step what I do to run app on physical android device:
- Open 'android' folder from app folder in IntelliJ
- Run in IntelliJ, target: USB device
- After .apk finish installing, shift-right click in app folder, run PowerShell, type 'react-native run-android'
- After it finish, open app on physical device, shake it to open developer menu, and hit 'Reload'
you can also hold menu button on your device to open developer menu(while app is running)
Solution 8:[8]
I also faced same issue in the emulator. So the way I solved it is by going into Android settings - Apps - select the app, and force stop it. Then I tried opening the app again and it worked.
Before I did this, I removed the 'build' folder under /android/app/ and re-ran. Did not work.
Solution 9:[9]
One thing that often resolves this problem for me is re-installing your node_modules folder and cleaning your gradle build. You can do this manually, however, if you've run into this problem once or many times, consider running a shell script to automate this process.
Create a file called clean.sh
and paste this inside:
echo "Removing node modules from $1 then reinstalling..."
cd $1
rm -rf node_modules
yarn install
echo "Cleaning gradle project..."
cd android
./gradlew clean
cd ..
If using npm, change "yarn" above to "npm".
Put the file above in the parent directory of your project (if your project is located at C:\Users\your.name\projects\project1
put the clean.sh
file at C:\Users\your.name\projects\
).
To run the script, inside of Git Bash or your Unix terminal run this (make sure to change the name of the directory below to the parent directory of your project):
cd C:/Users/your.name/projects
./clean.sh <project-name>
Now when restarting your app, try also reset the packager's cache.
With yarn:
yarn start --reset-cache
yarn android
With npm:
npx react-native start --reset-cache
npx react-native run-android
Solution 10:[10]
In my case I had a metro terminal running from my previous project. closing it and running the new project again solved the issue.
Solution 11:[11]
Use react-native-splash-screen. I try many ways to fix this issue but it's not working and i think this is the best way.
Solution 12:[12]
For me my wifi was disconnected on my test device.
I had to make sure both my computer running the react packager/server and my device were connected to the same wifi network.
Solution 13:[13]
I have recently faced this kind of white screen problem
1.always showing white screen after Release
"npx react-native start" and then
"npx react-native run-android"
2.it shows white screen some particular seconds or suddenly always shows the white screen in a properly working app
due to app cache or traffic and android Newer version also in some case when you are using API with HTTP instead of HTTPS
The reason is that newer android versions are more secure and they try to restrict HTTP request
solutions are
add this line in path project\android\app\src\main\androidmanifest.xml
:
android:usesCleartextTraffic="true"
Solution 14:[14]
It can not find its navigation's rout. You should check the navigation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow