Could not find com.android.tools.build:gradle:3.0.1

转自:https://blog.csdn.net/m00123456789/article/details/78917629

更新gradle后运行应用,报错。 
解决办法: 


提示找不到gradle:3.0.1 
在顶层build.gradle 中,可以看到build.gradle的配置:

buildscript {
    repositories {
        jcenter()
     }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}


需要做的修改:添加maven仓库,即在repositories中添加

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

修改后

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

这里可以对比一下2.2.3的配置

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

--------------------- 
作者:Study_WangYL 
来源:CSDN 
原文:https://blog.csdn.net/m00123456789/article/details/78917629 
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(Android)