Mak*_*sim 6 javascript mobile android react-native
如何从我的 react-native 项目构建 android apk?此命令“react-native run-android”在文件夹 android\app\build\outputs\apk\ 上创建 app-debug.apk 但是当我在手机上安装它时,出现错误“无法下载 JS 包”。当我第一次开始使用模拟器时,我使用命令来解决这个问题:
react-native start curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
Run Code Online (Sandbox Code Playgroud)
小智 6
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res 为调试版本手动创建包。打包后构建APK
cd android./gradlew assembleDebug./gradlew assembleRelease小智 4
您可以从此链接下载 Android Studio 安装程序:Android Studio 安装程序链接
一个更简单的方法是,如果您有一些 Android Studio 使用+“Android”过去的经验,
即使您没有任何 Android Studio 经验,我也给出了构建构建的分步解决方法,上面还提到了 Android Studio 设置链接:
现在等待几分钟,Android Studio 就会完成为您的应用程序制作 Android APK 的过程。
完成后,您可以在“YOURPROJECT/android/app/debug”文件夹中找到 React Native 应用程序的 Android APK 文件,或者如果是发布版本,则在“YOURPROJECT/android/app/release”文件夹中找到。
| 归档时间: |
|
| 查看次数: |
17636 次 |
| 最近记录: |