question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

unable to load script from assets index.android.bundle - React Native

See original GitHub issue

šŸ› Bug Report

I am trying to create the native react app by learning some tutorials and using react-native-cli. I am getting this error while running the application on android platform using react-native run-androidscript. The error I am getting is unable to load script from assets index.android.bundle. Make sure your build is packaged correctly and you are running a packager server. I tried setting port for TCP. After reading a lot of articles here I found this solution by running the command

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

So I added this command in my package.json. Now every time I have to run this command for the changes in code, live refreshing is not working and as I have seen in many tutorial that a development server will start but nothing is starting. I still didnā€™t understand why this error occurs and why not a JS development server is starting ?

Here is the info of react version - react-native-cli: 2.0.1 react-native: 0.58.6

To Reproduce

Create a native app using react-native-cli

Expected Behavior

Should run app and development server

Code Example

https://stackoverflow.com/questions/54975709/unable-to-load-script-from-assets-index-android-bundle-react-native

Environment

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15

github_iconTop GitHub Comments

13reactions
Hesowcharovcommented, Jun 21, 2019

Highly recommend to take account this answer - https://stackoverflow.com/a/53326616: for 28 api-level (Starting with Android 9.0 (API level 28), cleartext support is disabled by default.)

8reactions
joseph-perezcommented, Mar 4, 2019

Turns out I should pay more attention and read the release notes! šŸ˜‚ šŸ˜… I was able to fix my issue by using gradle 3.1 as recommended in the react native release notes for 0.57.

In my project I modified /android/build.gradle and changed

classpath 'com.android.tools.build:gradle:3.3.2'

to

classpath 'com.android.tools.build:gradle:3.1.4'

Once that was done I tried building my app on a device again and everything worked as expected!

This issue helped me A LOT to understand what was happening - https://github.com/Microsoft/react-native-code-push/issues/1427#issuecomment-430913598

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load script from assets index.android.bundle
It may be caused by unlinked assets in your React Native project code base, like when you renames your project applicationĀ ...
Read more >
Solved: Unable to load script from assets 'index.android.bundle'
Follow this. Go to your project directory and check if this folder exists android/app/src/main/assets. i) If it exists then delete two filesĀ ...
Read more >
"Unable to load script from assets 'index.android.bundle'..." #269
Go to your project directory and check if this folder exists android/app/src/main/assets Ā· From your root project directory do Ā· Finally, navigateĀ ...
Read more >
Unable to load script from assets index android bundle on ...
1.(in project directory) mkdir android /app/src/main/assets2. react - native bundle --platform android --dev false --entry-file index.jsĀ ...
Read more >
Unable To Load Script From Assets index.android.bundle
This problem happens when we run the application using react-native run-android and it gets successfully installed in the device but either the developmentĀ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found