升级 Android Studio 3.0 遇到的众多问题 ——我称之为“ 填坑之旅”

1、plugin to version 3.0 and Gradle to version 4.1

解决:跟新gradle 4.1不翻墙很难更新下来,从网上借助坑友们提供的gradle-4.1-all.zip(有需要的评论区留邮箱发给你) 放到本地来下载配置速度快的不能再说

具体跟新方法问度娘

gradle下载:

http://services.gradle.org/distributions

官网:http://gradle.org/release-candidate/

2、Cannot set the value of read-only property 'outputFile' for 

ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}}

 of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.

解决:

原来:
output.outputFile = new File(output.outputFile.parent, projectName + "_RELEASE_V" + defaultConfig.versionName + ".apk");  
改为:注意
 variant.outputs.all 和 outputFileName
 
applicationVariants.all { variant ->
    variant.outputs.all {
        def projectName = '****';
        def date = new Date().format("yyyyMMdd" , TimeZone.getTimeZone("GMT+08"))
        if (variant.buildType.name.equals('release')) {
            outputFileName = projectName + "_RELEASE_V_${versionName}_${date}.apk";
        }
        if (variant.buildType.name.equals('beta')) {
            outputFileName = projectName + "_BETA.apk";
        }
        if (variant.buildType.name.equals('debug')) {
            outputFileName = projectName + "_DEBUG_V_${versionName}_${date}.apk";
        }
    }

}

3、Warning:The specified Android SDK Build Tools version (25.0.0) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

解决:项目右键 open module settings --->buildToolsVersion修改为26.0.2

4、Error:Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
> Failed to transform file 'pl……r-1.4.1.jar' to match attributes {artifactType=android-classes} using transform JarTransform

   > Transform output file E:\AndroidStudio\Servyou_Project\AS3.0\zhyt_lj\mobile-taxsupport-hebei-android-as30\app\libs\pl……r-1.4.1.jar does not exist.

解决:用implementation或api替换compile

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值