Help us understand the problem. What is going on with this article?

ReactNative Androidで 『Unable to load script from assets index.android.bundle』エラーが出た時の対処法

More than 1 year has passed since last update.

はじめに

Unable to load script from assets index.android.bundle 関係は様々なエラーが存在していて毎回忘れるので発生する度に追記していきます。

エラー内容(1)

今回の場合は、 index.android.bundleが読み込めないよってエラー。

error
Unable to load script from assets 'index.android.bundle' Make sure your bundle is packaged correctly or you're running a packager server.

解決方法

android/app/src/main/assets/ 配下に index.android.bundle を生成する必要があるので以下のコマンドを実行。

$ mkdir android/app/src/main/assets
$ 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

以下2ファイルが生成されてエラーが解消される。
index.android.bundle
index.android.bundle.meta

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away