繁体   English   中英

带有react-native的Android应用程序可以在模拟器上运行,但不能在物理设备上运行

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

我认为标题说明了我的问题,在模拟器上一切正常,在构建APK时,我已将其转移到智能手机上,并且出现错误:

https://imgur.com/a/pSEKXHx

组装Release / Debug apk并将其安装在物理智能手机上时,我遇到了同样的问题

在您的项目目录中执行以下命令:

mkdir android/app/src/main/assets

(如果您拥有资产文件夹,则会看到类似directory is already exist错误……没问题!转到下一个命令)

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或组装apk

它应该工作不错

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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