AS 3.1.3 gradle-4.1-all.zip找不到com.android.tools.build:gradle:3.0.1

时间:2018-07-28 16:09:53

标签: android gradle

build.gradle文件内容:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.novoda:bintray-release:0.8.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
    }
}
allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
ext {
    compileSdkVersion = 26
    buildToolsVersion = "26.0.2"
    minSdkVersion = 16
    targetSdkVersion = 26

    lib_appcompat_v7 = 'com.android.support:appcompat-v7:26.1.0'
    lib_support_v4 = 'com.android.support:support-v4:26.1.0'
    lib_support_design = 'com.androdi.support:design:26.1.0'
}

同步失败。这样的错误:

  

找不到com.android.tools.build:gradle:3.0.1。   在以下位置搜索:       https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom       https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar   要求:       项目:thirdLibrary:WordPressEditor

1 个答案:

答案 0 :(得分:0)

(1)将google()放在jcenter()上。然后再次同步项目。

(2)检查是否在File> Setting > Build, Execution... > Gradle > Offline work中禁用了离线模式。 (取消选中此框

// 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'
        classpath 'com.novoda:bintray-release:0.8.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
    }
}
allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
ext {
    compileSdkVersion = 26
    buildToolsVersion = "26.0.2"
    minSdkVersion = 16
    targetSdkVersion = 26

    lib_appcompat_v7 = 'com.android.support:appcompat-v7:26.1.0'
    lib_support_v4 = 'com.android.support:support-v4:26.1.0'
    lib_support_design = 'com.androdi.support:design:26.1.0'
}