React Native Android打包apk
按照官方的5步曲:
1.在终端里面,cd 到项目的根目录后.执行下面这行命令:
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
然后终端就会让你输入口令等信息.如
2.执行第一步会在根目录下会生成一个XXXXXX.keystore的文件,直接拿到android/app下.
3.在android/gradle.properties中加入:
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=
MYAPP_RELEASE_KEY_PASSWORD=
换为你刚才输入的口令.
4.在android/app/build.gradle添加下面的红色字.
def enableProguardInReleaseBuilds = true
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 }} splits {
....
} buildTypes { release { signingConfig signingConfigs.release ... } }
.....
} } }
}
5.终端cd 到android目录下.执行命令
./gradlew assembleRelease
等一下终端执行后显示BUILD SUCCESSFUL.
成功打好了.在项目的android/app/outputs/apk下可见刚才打好的apk包
相关推荐
游走的豚鼠君 2020-11-10
81417707 2020-10-30
ctg 2020-10-14
小飞侠V 2020-09-25
PncLogon 2020-09-24
jipengx 2020-09-10
颤抖吧腿子 2020-09-04
wwzaqw 2020-09-04
maple00 2020-09-02
青蓝 2020-08-26
罗忠浩 2020-08-16
liduote 2020-08-13
不知道该写啥QAQ 2020-08-02
pengruiyu 2020-08-01
wmd看海 2020-07-27
孝平 2020-07-18
Eduenth 2020-07-05
iftrueIloveit 2020-07-04