Last active
September 3, 2018 08:01
-
-
Save Visionchen/e99ea4d15c2324be10d1cf2b47a0cf37 to your computer and use it in GitHub Desktop.
Windows下 React Native安卓项目打包APK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 使用Android studio生成一个key文件 | |
| ```html | |
| build->Generate Signed APK | |
| key store path选择jks文件保存位置 | |
| Password confirm | |
| Alias 别名 | |
| 别名密码 | |
| Ciountry Code :ch | |
| ``` | |
|  | |
| ### 将jks拷贝到/android/app目录下 | |
| -修改android/gradle.properties文件,添加 | |
| ```javascript | |
| MYAPP_RELEASE_STORE_FILE=jks文件名(注意带上jks后缀) | |
| MYAPP_RELEASE_KEY_ALIAS=别名 | |
| MYAPP_RELEASE_STORE_PASSWORD=密码 | |
| MYAPP_RELEASE_KEY_PASSWORD=密码 | |
| ``` | |
| ### 修改android/app/build.gradle文件中的签名配置 | |
| ```javascript | |
| ... | |
| android { | |
| ... | |
| defaultConfig { | |
| ... | |
| } | |
| 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 | |
| } | |
| } | |
| } | |
| ``` | |
| ### 然后cd到android目录执行打包 | |
| ```javascript | |
| gradlew.bat assembleRelease --console plain | |
| ``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment