2016-02-23 77 views
0

我也跟着这样的:https://github.com/facebook/react-native/issues/2943如何从index.android.bundle生成.apk文件?

$ cd your_project_dir 
$ npm start # start the packager if not started already 
$ curl "http://localhost:8081/index.android.bundle?platform=android?dev=false" -o "android/app/src/main/assets/index.android.bundle" 

并成功产生index.android.bundle文件。但奇怪的是,这里没有任何内容解释了如何将其转化为版本.apk文件。

编辑:

我所做的:

$ react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ 

android/app/src/main/res/只有一个清单文件和应用程序的图标。没有.apk文件。

+0

你试图获得释放或调试APK? –

+0

@ G.Hamaide一款发布apk。 – alex

回答

1

您需要按照RN official docs上的这些步骤才能获得发行版apk。然后,您可以在那里找到它:android/app/build/outputs/apk/app-release.apk

基本上你需要:

  1. 生成签名密钥

  2. 设置gradle这个变量

  3. 添加签约配置到您的应用等级配置

  4. 生成发布APK

+0

请检查我更新的问题。 – alex