Skip to content

Instantly share code, notes, and snippets.

@RichardNi
Last active August 29, 2015 14:14
Show Gist options
  • Save RichardNi/44cb1f4618b4cf4b42f8 to your computer and use it in GitHub Desktop.
Save RichardNi/44cb1f4618b4cf4b42f8 to your computer and use it in GitHub Desktop.
android gradle 发布release版本时配置签名证书
android {

    ...
    
    signingConfigs {
        releaseConfig {
            storeFile file(System.getenv("KEYSTORE_PATH"))
            keyAlias System.getenv("KEY_ALIAS")
            storePassword System.getenv("KEYSTORE_PASSWORD")
            keyPassword System.getenv("KEY_PASSWORD")
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.releaseConfig
        }
    }
}

通过环境变量获取相关证书参数,这样更安全

KEYSTORE_PATH: 证书文件路径;

KEY_ALIAS: 证书别名;

KEYSTORE_PASSWORD: 密码;

KEY_PASSWORD: 密码;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment