ANDROID studio 3.0.1版本默认新建项目下build.gradle如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        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
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

增加了代理,又增加了aliyun的镜像后, 还是无法下载对应的包, 不知道是不是3.0.1太新了, 修改为2.3.3:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
    // maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
       // google()
       jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'


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

allprojects {
    repositories {
        // maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
       // google()
       jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

下载成功!又提示我gradle太旧,我的是3.1,它说至少得3.3以上. 它也不提示个升级方法...
升级gradle: 下载,解压,改路径到bin.

标签: none 阅读量: 1373

添加新评论