React Native - 有一种简单的方法来构建和部署调试APK吗?

git*_*ble 6 android react-native react-native-android

所有文档似乎都认为其中一个处于开发模式并寻求为开发人员设备切换端口或正在进行生产构建!我只是想创建一个appDebug.apk,任何人都可以使用它来运行应用程序,而不会看到有关桥接,事件发射器或AppRegistry等的错误.我不能告诉其他人想要看到React Native应用程序来切换端口等,以及每次我分享应用程序时,我都不想完整发布.有什么建议?

更新:我不想调试应用程序.我只是想发布一个适用于任何人设备的测试版本,以便我可以共享构建以进行测试.

 UPDATE: HERE IS MY PROJECT STRUCTURE:under
   main-project
   -> index.android.js
   ->gridlew
   -> build.properties
   ->build.gradle
   ->package.json
   -> my-app  (App project folder)
       -> build->output->apk->release.apk 
       ->src->main->assets
       ->src->main->res 
       ->src->main->java
Run Code Online (Sandbox Code Playgroud)

git*_*ble 4

以下是从创建反应本机应用程序生成的 build.grade 中进行这项工作所需的步骤:

这是您的应用程序构建文件:

import com.android.build.OutputFile
// These properties must be declared above the apply below!
project.ext.react = [
    // whether to bundle JS and assets in debug mode
    bundleInDebug: true,

    // whether to bundle JS and assets in release mode
    bundleInRelease: true,

    bundleIn$releaseDebug: true  // For custom release type

  ]


 apply from: "../node_modules/react-native/react.gradle"  // adjust depending on where your node_modules directory is located.
Run Code Online (Sandbox Code Playgroud)

另请检查您是否在 build.gradle 中使用应用程序包名称等定义了 ext 属性。

这有效并且为所有构建类型成功创建了捆绑包。