I am still on the mission to make some kind of app. But I ran into a problem which I like to call “the red screen” and keeps turning up and up… In this post, I will share all the solutions I have been trying so far…
What is the problem?
I wish I knew. Whenever I start the Android studio Emulator and then run my app the Emulator shows a red screen. I know the messages on the screen should help me, but I cannot decipher them.
Sometimes I get the Emulator to work. So far these were the steps which helped me. Right now I am having the red screen issue again… So I think this is an issue which is coming up a lot, so sharing the different possible solutions might help others…
First things first
The red screen is bothering a lot of people… so on this page, there are already solutions to some problems like port 8081 is occupied or a name is too long. Go and check this one out first. If your solution is on there… yay!! of not… here are some more possible solutions…
New is not always working
I think I mentioned it in my last post. The world is changing fastly and so are the languages and programs we are using. So at the time the Udemy course I am taking the react-native thingy just seemed to work. But in the newer versions which have come out since then are some bugs. So instead of working with the most recent version, you might want to go back in time and work with a later – bug-free -version.
Go to your command prompt. Change your directory to your react-native file and type:
react-native init — “version = 0.55.4” [name of your project]
react-native init [name of your project] — version 0.55.4
then go and set cour cd to the file with your project and type
which will give you the version on which you are running.
Of course, you can choose any version you want. It does not have to be 0.55.4… just make sure it is an existing one 😉
Still not working?
Yep, I know the feeling… so then it might be because the SDK location cannot be found. To solve this define the location with sdk.dir in the local.properties file.
Define the SDK location
To know where your SKD is located, open up your Android Studio, click on the tab File – Project Structure and then und SDK location you see the path to the SDK. Copy this and open up your editor and open up your react-native project. I am not quite sure whether your project already should have a local.properties file, but apparently this one should be in the android folder. So if it is not there, just go one and create a new one.
Make sure the path is given in the correct format. It should look like this (for Windows):
sdk.dir = C\:\\Users\\username\\AppData\\Local\\Android\\Sdk
Of course, this did not work for me either…
The green Play Button
On this StackOverflow thread someone wrote that in the Android Studio, you should hit the green Play Button, which of course I did… and then you should do some other stuff… but when I actually had the Android Studio open I saw, that for some reason it was still pointing to an old project I had done… so opened the new project… and run it again in the cmd…
And I did not get an error message in the cmd… but on the emulator, I was stuck on a white “loading” screen. I then closed everything and started it up again (meaning starting Android Studio, running all the cmd commands) and voilà! My screen is no longer red!! YAY hurray we did it!
Although I am not sure which of all the steps I took actually did the trick, those are the measures you can take to solve your red screen issue.
Happily ever after
Fingers crossed and I will not have the red screen issue again 🙂
Thank you for reading!