Android Studio升级3.0构建项目各种报错

1.Could not resolve all files for configuration ':classpath'.Could not find com.android.tools.

Error:Gradle: A problem occurred configuring root project 'MyApplication'.

> Could not resolve all files for configuration ':classpath'.

  > Could not find com.android.tools.build:gradle:3.0.0.

    Searched in the following locations:

        https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom

        https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar

    Required by:

2.Error:SSL peer shut down incorrectly 

3.can't get resource


解决方法:

1. gradle版本是3.0以上的可以在project的build.gradle文件里添加  google()方法,3.0以下会报这个错误(Gradle DSL method not found: 'google()')

buildscript {

    repositories {

        jcenter()

        google()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:3.0.0'

    }

}

allprojects {

    repositories {

        jcenter()

        google()

    }

}

2.  3.0以下gradle的可以把google() 换成

maven {

url'https://maven.google.com/'

    name'Google'

}

你可能感兴趣的:(Android Studio升级3.0构建项目各种报错)