android studio多平台打包,Android Studio多渠道打包问题汇总(持续更新中)

0X01、Error:Removing unused resources requires unused code shrinking to be turned on.

修改build.gradle文件中buildTypes的:minifyEnabled值为true

debuggable值为 truebuildTypes {

debug {

signingConfig signingConfigs.release

buildConfigField "boolean", "ISDEBUG", "true"

debuggable true

minifyEnabled true

shrinkResources true

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

release {

signingConfig signingConfigs.release

minifyEnabled true

zipAlignEnabled true

debuggable true

shrinkResources true

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

}

0X02、WARNING: API 'variantOutput.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.

WARNING: API 'variantOutput.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.

It will be removed at the end of 2019.

For more information, see https://d.android.com/r/tools/task-configuration-avoidance.

To determine what is calling variantOutput.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.

Affected Modules: app

修改build.gradle文件中buildTypes的://输出的为渠道包的名字,例如 xiaomi.apk

applicationVariants.all { variant ->

variant.outputs.each { output ->

def outFile = output.outputFile

if (outFile != null && outFile.name.endsWith(".apk")) {

def fileName = "${variant.productFlavors[0].name}" + ".apk"

output.outputFile = new File(outFile.parent, fileName)

}

}

}

修改后://输出的为渠道包的名字,例如 xiaomi.apk

applicationVariants.all { variant ->

variant.outputs.all { output ->

outputFileName="${variant.productFlavors[0].name}_${variant.versionCode}

-${variant.versionName}-${releaseTime()}.apk"

}

}

0X03、GC overhead limit exceeded

修改项目目录下的gradle.propertiesorg.gradle.jvmargs=-Xmx1024m

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值