Is it possible to convert my react native app like codes to apk like I don't need to use Android studio

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

Is it possible to convert my react native app like codes to apk like I don't need to use Android studio

问题

我想知道如何实际生成或制作我的本地应用成为一个APK文件,就像我想尝试是否可以下载并使用它。就像几乎完成了,但仍然想知道如何让我的朋友下载并使用它,而不需要扫描二维码,因为这个应用程序应该可以离线工作,而Expo只是用于测试,当然你需要使用数据来实现它。

正在寻找解决方案,但仍然需要帮助,我陷入了困境。

英文:

I wanted to know how to actually generate or to make my native app an apk like I wanted to try if can download it and use it .Like it's almost done but still wanna know how can i let my friends download and use it without scanning the qr code because this app should work offline and expo is just for testing and ofcourse you have to use data for that

Trying to find solutions but still I need I help I'm stuck with this

答案1

得分: 0

你可以生成你的应用程序的调试版本,然后以任何你喜欢的方式与你的朋友分享生成的apk文件。要生成调试模式,请按照以下步骤操作:

第一步:在你的项目的根目录中运行:

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

第二步:进入android目录:

cd android

第三步:现在在这个目录中运行:

./gradlew assembleDebug

这将需要几分钟,直到apk文件准备就绪。
成功构建后,你可以在以下路径找到apk文件:
projectName/android/app/build/outputs/apk/debug/app-debug.apk

提示:请记住你应该使用更新版本的react-native。(此功能在版本 > 0.58之后可用)

英文:

You can generate a debug version of your app and then share the generated apk file with your friends however you desire. To generate the debug mode go through the following steps:

Step 1: In your project's root directory run:

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

Step 2: Go to android directory:

cd android

Step 3: Now in this directory, run:

./gradlew assembleDebug

It will take a few minutes until apk file is ready.
After a successful build, you can find the apk file in this path:
projectName/android/app/build/outputs/apk/debug/app-debug.apk

HINT: keep in mind you should use newer versions of react-native. (This feature is available after version > 0.58)

huangapple
  • 本文由 发表于 2023年5月13日 14:56:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76241457.html
匿名

发表评论

匿名网友

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

确定