1.将你的密钥复制到 android/app 目录下.
![](https://i-blog.csdnimg.cn/blog_migrate/268f5c50908540894413f125c0714af7.webp?x-image-process=image/format,png)
2.在android/gradle.properties文件中添加如下配置。
MYAPP_RELEASE_STORE_FILE=你的密钥名称
MYAPP_RELEASE_KEY_ALIAS=你的密钥别名
MYAPP_RELEASE_STORE_PASSWORD=密钥密码
MYAPP_RELEASE_KEY_PASSWORD=密钥密码
![](https://i-blog.csdnimg.cn/blog_migrate/4e89732d081ae40500f36bbbabf34de2.webp?x-image-process=image/format,png)
![](https://i-blog.csdnimg.cn/blog_migrate/071ffdb2713e97e0a1dcdb3151414ade.webp?x-image-process=image/format,png)
3.编辑 android/app/build.gradle文件添加如下代码:
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/a0bdfbc9cb9c518b58aa2e539dac74df.webp?x-image-process=image/format,png)
4.在cmd命令行中进入到当前项目的android目录,运行 gradlew assembleRelease ,苹果电脑貌似是要加(./gradlew assembleRelease)
![](https://i-blog.csdnimg.cn/blog_migrate/a0a919ef41daf4b249e9a644514af314.webp?x-image-process=image/format,png)
![](https://i-blog.csdnimg.cn/blog_migrate/3f436b910e817045fc8361c6b0b51244.webp?x-image-process=image/format,png)
这样就能看到打包好的apk了android/app/build/outputs/apk/app-release.apk
![](https://i-blog.csdnimg.cn/blog_migrate/15bf3027063b8b57356f126a7c5d2ab9.webp?x-image-process=image/format,png)
完结!!!!!!!!!!!
http://www.jianshu.com/p/ac6488b2d57f