Closed FredrickNarshChiluba closed 3 months ago
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
cd MyApp
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"
...
I have solved the problem using the below steps.
- Updated nodejs to the latest version.
- Deleted the all the contents from .gradle(C:/Users/xxx/.gradle) folder (You may skip this in the initial attempt)
- I created project using,
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.
It worked for me by doing one extra step. I had to delete two directories.
Then ran npx react-native run-android
command.
In my case, the emulator was on airplane mode. Make sure your emulator or mobile phone can communicate with the Metro server.
Thanks but same for me as well. It resolved now.
Im getting this error on real device. but not on emulator. I have tried few solutions mentioned above but none of them help me.
I tried executing network-security-config.xml change. It didnt help.
Then tried executing https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff
But nothing works for me. only installing apk, on app start it throws the error always
For my case,i want to load assets file to replace downloading from local-server,so i modified the MainApplication
to change ReactNativeHost
, and the reason is that the code is wrong. When i change to this, it runs well
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return false;
}
@Override
protected List<ReactPackage> getPackages() {
return new PackageList(this).getPackages();
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected ReactInstanceManager createReactInstanceManager() {
ReactMarker.logMarker(ReactMarkerConstants.BUILD_REACT_INSTANCE_MANAGER_START);
ReactInstanceManagerBuilder builder =
ReactInstanceManager.builder()
.setApplication(MainApplication.this)
.setJSMainModulePath(getJSMainModuleName())
.setUseDeveloperSupport(getUseDeveloperSupport())
.setRedBoxHandler(getRedBoxHandler())
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
.setUIImplementationProvider(getUIImplementationProvider())
.setJSIModulesPackage(getJSIModulePackage())
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
.setBundleAssetName("index.android.bundle");
for (ReactPackage reactPackage : getPackages()) {
builder.addPackage(reactPackage);
}
ReactInstanceManager reactInstanceManager = builder.build();
ReactMarker.logMarker(ReactMarkerConstants.BUILD_REACT_INSTANCE_MANAGER_END);
return reactInstanceManager;
}
};
I was running into this same issue on Windows 10. The problem I was experiencing was I had something running on port 8081. When I stopped it, everything worked.
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.
Im getting this error on real device. but not on emulator. I have tried few solutions mentioned above but none of them help me.
I tried executing network-security-config.xml change. It didnt help.
Then tried executing medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff
But nothing works for me. only installing apk, on app start it throws the error always
Same thing for me. Did you ever get this working on a real device?
I am having this issue in release mode
Same here using npx react-native run-android --variant=release
. I've used ./gradlew clean
into android
folder but the issue persists. No sign of this problem in debug mode. I'm using RN 0.69.3
.
i just delete node_module and reinstall it and its work for me
I still have that problem. someone help please. my emulator is not in airplane mode
I have build the app using fastlane and when i am opening the app, bugsnag is reporting this errror,
Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
hi , pease try to start metro server or CLI using npm start or npx react-native start
thankyou
From: Shivam Kumar @.> Sent: Wednesday, July 12, 2023 6:23 PM To: facebook/react-native @.> Cc: Navin Nahar @.>; Comment @.> Subject: Re: [facebook/react-native] 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. (#27157)
"External Email Notice: This email originated from outside your organisation. Please be mindful of safe email handling and open the attachments / links contained there-in only if the sender is trustworthy and known to you."
I have build the app using fastlane and when i am opening the app, bugsnag is reporting this errror,
Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
— Reply to this email directly, view it on GitHubhttps://github.com/facebook/react-native/issues/27157#issuecomment-1632476500, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV5RMPVIL3IJ6OSRXFTGZELXP2M4VANCNFSM4JKIOYJA. You are receiving this because you commented.Message ID: @.***>
DISCLAIMER: The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future. DISCLAIMER: The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.
I have build the app using fastlane and when i am opening the app, bugsnag is reporting this errror,
Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
Did you resolve this, I used Fastlane as well, and I get this error in production
I'm not sure which of these things really fixed it for me, but after 3 days of trying to figure this out here's what I changed to make it work without hacks and allowing to make hot reloading still work in dev:
Hopefully it works, this error is just so out of nowhere.
I'm not sure which of these things really fixed it for me, but after 3 days of trying to figure this out here's what I changed to make it work without hacks and allowing to make hot reloading still work in dev:
- Removed node_modules, package-lock.json
- I switched to node version 18.7.1 with nvm
- I added android:usesCleartextTraffic="true" in AndroidManifest.xml
- ran npm udpate
- But what I think sealed the deal, was going to settings of my phone and deleting the apps cache and data Hopefully it works, this error is just so out of nowhere.
Where in your project is AndroidManifest.xml can't seem to find it on mine?
Where in your project is AndroidManifest.xml can't seem to find it on mine?
The file is in android/app/src/main
hi , pease try to start metro server or CLI using npm start or npx react-native start thankyou … ____ From: Shivam Kumar @.> Sent: Wednesday, July 12, 2023 6:23 PM To: facebook/react-native @.> Cc: Navin Nahar @.>; Comment @.> Subject: Re: [facebook/react-native] 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. (#27157) "External Email Notice: This email originated from outside your organisation. Please be mindful of safe email handling and open the attachments / links contained there-in only if the sender is trustworthy and known to you." I have build the app using fastlane and when i am opening the app, bugsnag is reporting this errror, Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. — Reply to this email directly, view it on GitHub<#27157 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV5RMPVIL3IJ6OSRXFTGZELXP2M4VANCNFSM4JKIOYJA. You are receiving this because you commented.Message ID: @.***> DISCLAIMER: The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future. DISCLAIMER: The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.
This worked perfectly for me. apparently i was trying to install the app on my physical device but hadn't yet started by running this command.
Nb: If you try to run the command above (npx react-native start) and you get an error concering the port 8081 already in use, kill the processes on the port by running very simple commands. i used chatgpt for this (just lookup how to kill running processes on port 8081 for eg windows) . And try again
Best!
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Nice, Had to connect the Emulator to Android WIFI. It's a weird issue.
In my case, the emulator was on airplane mode. Make sure your emulator or mobile phone can communicate with the Metro server.
That was my mistake, thanks @dipo1
React Native version:
Steps To Reproduce
1. 2.
Describe what you expected to happen:
Snack, code example, screenshot, or link to a repository: