在build.gradle文件中,android节点下进行配置。
android { compileSdkVersion 22 buildToolsVersion '22.0.1' signingConfigs { release { keyAlias 'xxx' keyPassword 'xxxxxxxxxxxx' storeFile file('./xxx.keystore') storePassword 'xxxxxxxxxxxxxxxx' } config { keyAlias 'xxxx' keyPassword 'xxxxxxx' storeFile file('./xxx.keystore') storePassword 'xxxxxxxx' } } defaultConfig { applicationId "com.xxx.xxxxx" minSdkVersion 14 targetSdkVersion 22 versionCode 7 versionName "2.2.1" signingConfig signingConfigs.release } //配置debug模式下,使用正式版签名,此操作主要为了方便调试微信,新浪等第三方登录授权 buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' debuggable true signingConfig signingConfigs.release } debug { signingConfig signingConfigs.release } } //渠道 productFlavors { baidu { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "baidu"] } qihu360 { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "qihu360"] } tencent { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "tencent"] } } sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/jniLibs', 'src/main/jniLibs'] } } //修改生成的apk名字 applicationVariants.all { variant -> variant.outputs.each { output -> def oldFile = output.outputFile if (variant.buildType.name.equals('release')) { def releaseApkName = 'pintuan_' + variant.productFlavors[0].name + '_release_' + defaultConfig.versionName + '.apk' output.outputFile = new File(oldFile.parent, releaseApkName) } } }}
版权声明:本文为博主原创文章,未经博主允许不得转载。