1.在APPmodule中的build.gradle中添加如下代码
signingConfigs { release { keyAlias RELEASE_KEY_ALIAS keyPassword RELEASE_KEY_PASSWORD storeFile file(RELEASE_STORE_FILE) storePassword RELEASE_STORE_PASSWORD } debug{ keyAlias RELEASE_KEY_ALIAS keyPassword RELEASE_KEY_PASSWORD storeFile file(RELEASE_STORE_FILE) storePassword RELEASE_STORE_PASSWORD } }
buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } }
android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "app_${variant.buildType.name}_V${variant.versionName}.apk" } }
2.在项目目录中的gradle.properties添加如下代码
RELEASE_KEY_PASSWORD=cccccc RELEASE_KEY_ALIAS=bbbbbb RELEASE_STORE_PASSWORD=aaaaa RELEASE_STORE_FILE=D:/aaaaaaa/bbbbbb/cccccc/dddddd.jks
3.项目的gradle工具中编译