28
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-12-02

はじめに

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

28
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?