'Error: ENOENT: no such file or directory, open 'android\app\src\main\assets\index.android.bundle'

I created react-native init project

then I run the project using react-native run-android it will run without any issues.

When i try to build apk using below comment

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

I m facing this error

error ENOENT: no such file or directory, open 'android\app\src\main\assets\index.android.bundle'. Run CLI with --verbose flag for more details. Error: ENOENT: no such file or directory, open 'android\app\src\main\asset\index.android.bundle'



Solution 1:[1]

Check whether the folder assets exists in your project's 'android\app\src\main' ; if it does, it implies that the file 'index.android.bundle' does not; simply create the file on the folder. If the folder is not there, both the folder and the file must be created.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tanay Tapanshu