android studio 升级3.2+
2018-10-23 本文已影响60人
萧胜天_
1、升级gradle 至 gradle-4.6-all.zip
2、项目build.gradle
classpath 'com.android.tools.build:gradle:3.2.0'
3、升级对应的buildToolsVersion
4、如果出现依赖包下载不下来的问题,请先屏蔽掉,一个一个打开下载。
问题一
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "wants-$variant.buildType.name-v${defaultConfig.versionName}-${defaultConfig.versionCode}.apk";
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
变更为
applicationVariants.all { variant ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "wants-$variant.buildType.name-v${defaultConfig.versionName}-${defaultConfig.versionCode}.apk";
outputFileName = fileName
}
}
}
each 变更为all
output.outputFile -> outputFileName
问题二
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
将 compile 替换成implementation