React Native version:
1.
2.
Describe what you expected to happen:
Snack, code example, screenshot, or link to a repository:
The same problem on Windows 10. I tried suggestions found on web but no success.
react-native-cli: 2.0.1
react-native: 0.59.10
The same problem I am facing. Upgrading node, clearing cache none of it worked
I have solved the problem using the below steps.
react-native init MyApp
- Move to the project folder.
cd MyApp- I was getting some blacklist.js some character issue. For that I referred this link and replaced sharedBlacklist character set. (https://stackoverflow.com/questions/58120990/how-to-resolve-the-error-on-react-native-start/58122821#58122821)
- Next, I ran the below code snippet to address the bundle issue.( Ref Link : https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff)
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res- > react-native run-android
Then, it started working.
Hope this helps.
In my case, the emulator was on airplane mode.
Make sure your emulator or mobile phone can communicate with the Metro server.
Awesome it works, finally. Thank you so much
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
I still have that problem. someone help please. my emulator is not in airplane mode
I still have that problem.
Also still having that problem on 0.63.2
I have the same issue after upgrading from react-native 0.61.5 to 0.63.2.
npx react-native run-android and yarn start in a separate terminal window.npx react-native run-android --variant=Release.npx react-native run-android --variant=Staging. When running from Android Studio it logs the :point_up: error:Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
These are the buildTypes settings in my android/app/build.gradle (working fine for previous versions of react-native):
buildTypes {
debug {
resValue "string", "CodePushDeploymentKey", '""'
}
staging {
resValue "string", "CodePushDeploymentKey", '"******"'
signingConfig signingConfigs.release
matchingFallbacks = ['release']
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
resValue "string", "CodePushDeploymentKey", '"******"'
signingConfig signingConfigs.release
}
}
Please help! All the "solutions" I found so far were either suggesting to start a Metro Instance, or adding an assets folder (which already exists in my project), or running a three-lines-long bundle command – but surely there must be a better way!?
Update:
Adding bundleInStaging: true to my app/build.gradle as suggested in this answer solved this problem for me! :tada:
If you are encountering this issue on Android 28+ in Debug Mode, make sure you add this to your AndroidManifest.xml:
<application
+ android:usesCleartextTraffic="true"
...
In my case, the app was running ok in Production Mode, but it didn't start in Debug Mode. Because of some network security issues, the app was unable to connect to the Metro bundler, even when it was running.
Source:
https://reactnative.dev/docs/integration-with-existing-apps#cleartext-traffic-api-level-28
For more details & more fine grained approaches:
https://github.com/facebook/react-native/issues/22375
Hi everybody~
### Here is my solution
None of the above solutions can solve my problem but only follow the below steps working for me.
Add in network-security-config.xml file
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.0.2.2</domain>
</domain-config>
...
Then update AndroidManifest.xml file with
<application
+ android:networkSecurityConfig="@xml/network_security_config"
...
Most helpful comment
I have solved the problem using the below steps.