Last active
May 22, 2018 02:45
-
-
Save Orange168/e3973ed9f01dbfc1eeb234873116e35d to your computer and use it in GitHub Desktop.
gradle 常用代码
This file contains 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
gradle.properties | |
marvel_public_key = 74129ef99c9fd5f7692608f17abb88f9 | |
marvel_private_key = 281eb4f077e191f7863a11620fa1865f2940ebeb | |
//app build.gradle | |
defaultConfig { | |
applicationId cfg.package | |
minSdkVersion cfg.minSdk | |
targetSdkVersion cfg.targetSdk | |
versionCode cfg.version_code | |
versionName cfg.version_name | |
buildConfigField "String", "MARVEL_PUBLIC_KEY", "\"${marvel_public_key}\"" | |
buildConfigField "String", "MARVEL_PRIVATE_KEY", "\"${marvel_private_key}\"" | |
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | |
} | |
//use | |
BuildConfig.MARVEL_PUBLIC_KEY, BuildConfig.MARVEL_PRIVATE_KEY |
This file contains 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
//source from mr-mantou-android | |
android{ | |
//.... | |
applicationVariants.all { variant -> | |
variant.outputs.each { output -> | |
if (output.outputFile != null && output.outputFile.name.endsWith('.apk')) { | |
output.outputFile = file("${output.outputFile.parent}/Mr.Mantou" + | |
"-${variant.buildType.name.toLowerCase()}" + | |
"-${variant.versionName}" + | |
".apk") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment