How to create a release signed apk file using Gradle?

2019-10-16 11:55:19 浏览数 (1)

Put this into ~/.gradle/gradle.properties

代码语言:javascript复制
RELEASE_STORE_FILE={path to your keystore}
RELEASE_STORE_PASSWORD=*****
RELEASE_KEY_ALIAS=*****
RELEASE_KEY_PASSWORD=*****

Modify your build.gradle like this:

代码语言:javascript复制
signingConfigs {

   release {
       storeFile file(RELEASE_STORE_FILE)
       storePassword RELEASE_STORE_PASSWORD
       keyAlias RELEASE_KEY_ALIAS
       keyPassword RELEASE_KEY_PASSWORD
   }
}

buildTypes {
        release {
            signingConfig signingConfigs.release
        }
}

Then you can run

代码语言:javascript复制
./gradlew assembleRelease
ls app/build/outputs/apk/release 

参考:https://stackoverflow.com/questions/18328730/how-to-create-a-release-signed-apk-file-using-gradle

0 人点赞