Android Studio升级到3.0遇到的问题

2017-11-03  本文已影响0人  goodl

错误信息:
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.

解决方法:
Use output.outputFileName instead of output.outputFile

android.applicationVariants.all { variant ->
variant.outputs.all {
    outputFileName = "app_${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"  
} 

错误信息:
The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.0. Android SDK Build Tools 26.0.2 will be used. To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. Update Build Tools version and sync project

解决方法:
升级 buildToolsVersion 至 '26.0.2'

错误信息:
Could not find com.android.tools.build:gradle:3.0.0. Searched in the following locations:

解决方法:

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        google() // new which replace https://maven.google.com
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

错误信息:
Failed to resolve: com.android.support:appcompat-v7:25.4.0 Add Google Maven repository and sync project Show in File Show in Project Structure dialog

解决方法:

allprojects {
    repositories {
        ...
        // add new repository
        maven {
            url "https://maven.google.com"
        }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读