4

I use

react-native bundle --entry-file "index.android.js" --platform "android" --bundle-output "./assets/index.android.bundle" --verbose

to package the JS code bundle and put it into assets, it works but the local Image resources can't be displayed, the local image resources located in ./App/Img/ folder, and be used in:

const icon1 = require('./App/Img/slider.png');

How can I bundle this resource files too so that I can generate a single running apk.

herbertD
  • 10,657
  • 13
  • 50
  • 77

1 Answers1

3

I use the bundle command to bundle resources into android res/ folder:

    echo "START bundle for android normal resources release"
    react-native bundle \
    --platform android \
    --entry-file index.android.js \
    --bundle-output android/app/src/main/assets/index.android.bundle \
    --assets-dest  android/app/src/main/res/ \
    --dev false

then build with gradlew:

./gradlew installRelease
herbertD
  • 10,657
  • 13
  • 50
  • 77