升级 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



猜你喜欢

转载自blog.csdn.net/jian51868/article/details/79554236