简体   繁体   中英

Android app with react-native works on emulator but doesn't on physical device

I think title explains itself my problem, on emulator everything works as it should be, when apk builded I have transfered it on my smartphone and there's errors:

https://imgur.com/a/pSEKXHx

I was have the same issue when i assemble Release/Debug apk and install it on my physical smartPhone

Do this commands in your Project Directory :

mkdir android/app/src/main/assets

(if you have the assets folder you will see error like directory is already exist ... no problem! go to next command)

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 or assemble the apk

it should work GOOD LUCK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM