android studio 升级3.2+

发布时间:2019-06-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了android studio 升级3.2+脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

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

脚本宝典总结

以上是脚本宝典为你收集整理的android studio 升级3.2+全部内容,希望文章能够帮你解决android studio 升级3.2+所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。