androidreact-nativeandroid-emulatormetro-bundlerreact-native-cli

React Native works with a real device but not with an android emulator


I start my React Native project with the following commands:

It works when a real device connected to my PC and the project starts on my device. But it does not work with an Android Emulator.

When I try with an emulator:

But emulator does not start my project. I can see my project icon on the emulator. When I double click to my project, I just see a blank screen for one second or less and it closed again.

When i try to reload metro using r command on terminal it says no apps connected.

I think the emulator builds the app but not connect to metro properly. I don't know why. I cannot see any error or warning messages.

I tried ./gradlew clean and delete node_modules and install but it didn't work. I also tried yarn start --port 8081 but it also didn't work.

EDIT: For testing purpose, I created a new project with `npx react-native init AwesomeProject' and it works on the emulator. So I think the problem is only about the other project.


Solution

  • SOLUTION: In my case it was because of Flipper version. When I changed it from 0.125 to 0.144 my project started on an android emulator properly.

    Here is the link where i found the solution: react-native-issue-in-github