Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Android: Static Image is not showing in production released apk

I have static image in my react-native app accessing via

  <Image source={require("../assets/[email protected]")} />

in development it is showing well but in production release APK is not showing what can be the reason? I have followed steps mention here.

https://facebook.github.io/react-native/docs/signed-apk-android.html
like image 513
Waleed Arshad Avatar asked Aug 14 '16 10:08

Waleed Arshad


3 Answers

I'm using react-native v0.59.9 with shrinkResources true configuration. It makes react-native could not find the assets.

Make sure you do not set shrinkResources on android build.gradle unless the new version of react-native support it later on.

like image 81
surga Avatar answered Oct 22 '22 00:10

surga


I'm using RN 0.61.2

As stated by @made-in-moon here this worked for me:

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/

like image 27
Aqeeb Imtiaz Harun Avatar answered Oct 21 '22 23:10

Aqeeb Imtiaz Harun


This is the command that did it for me:

react-native bundle --platform android --dev false --entry-file index.android.js \ --bundle-output android/app/src/main/assets/index.android.bundle \ --assets-dest android/app/src/main/res/

take a look at github issue>

like image 23
Waleed Arshad Avatar answered Oct 22 '22 00:10

Waleed Arshad