React Native发布Android

huangapple go评论70阅读模式
英文:

React Native publication Android

问题

我用React Native为个人使用编写了一个非常好的应用程序。我感到惊讶的是,我无法构建并在我的手机上运行它。在ReactJS中,这可以通过一个命令完成,React Native没有简便的方式吗?我已经尝试了很多次。我得到了AAB文件,并尝试使用APKMirror Installer和其他应用程序运行它。这不起作用。

英文:

I wrote a very nice application for personal use in React Native. I'm surprised I can't build it and run it on my phone. In ReactJS, this is done in one command, doesn't React Native have an easy way to do this? I've tried a lot already. I got the AAB file and tried running it with APKMirror Installer and other apps. This doesn't work.

答案1

得分: 1

如果你使用 Expo 库,那会很容易,你只需要在运行时扫描二维码。

如果你没有使用 Expo,而是裸项目(bare project),你需要使用以下命令创建 Android 的 APK 文件。

注意:你需要将所有文件复制到手机或模拟器上进行测试。

参考链接:

  • Expo文档:https://docs.expo.dev/
  • Android构建命令行:https://developer.android.com/build/building-cmdline
英文:

If you're using expo library, it will be very easy, all you need to do is scan qrcode when running it by

expo start

If you're using without expo which is bare project you need to create apk file using below command for Android

./gradlew assembleDebug   // apk file for debugging
./gradlew assembleRelease   // apk file production for preview purpose
./gradlew bundleRelease // aab file for production to upload on Play Store

Note: you need to copy all the file on your mobile or emulator to test it

Reference :

https://docs.expo.dev/

https://developer.android.com/build/building-cmdline

huangapple
  • 本文由 发表于 2023年5月21日 12:55:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76298353.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定