The application compiles without errors and the Android emulator is running properly.
However, when I run react-native run-android, I get the following error:
After clicking reload I get another error message:
Please note that the Metro Bundler is in fact running on port 8081. (Opening http://127.0.0.1:8081/ with a browser (or curl) gives me: React Native packager is running.)
I also tried the following without success (same error):
cleared all node_modules and all Android build files and started over
started metro server manually with npm start -- --reset-cache
However, I have no idea where this 10.0.2.2 ip address is coming from. (It’s not my local network, nor is the service running on that ip. It’s running on localhost.)
I’ve spent hours on Stackoverflow and other web sites to research this. The only useful info was to use the statement react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res, which was the only way to get it working. And as you’ve already told me that’s not the solution.
I also tried to set the debug server to 127.0.0.1:8081, but this does not work either.
However, accessing http://127.0.0.1:8081/index.android.delta?platform=android&dev=true&minify=false on my host and within the emulator’s browser yields a response from the metro server.
I just hope that someone with react-native experience and this project might have an answer. I guess only time will tell. Until then, I will have to use this rather akward “bundle” workaround, which is detrimental to any real development work.
I am running into the same issue, I initially got the application running by using
react-native run-android and it worked fine until I tried to reload the App.
I also tested this using the iOS simulator and it is working fine and behaving like a normal react-native app. It seems like this is connected to the Android App. I feel like the metro server is working fine there must be something wrong with the Android App.
I am a bit helpless on how to progress from here and there is not much information I can find for this.
I’ve recently made various changes to the build to get it working on Android 9 emulator. You might want to pull the last changes to see if it makes a difference.
What does your URL say? You have add your IP address that shows up there to the file ReactNativeClient/android/app/src/main/res/xml/network_security_config.xml.
If that does not fix your issue, you have a different problem.