【问题标题】:Gradle Project Sync Failed - Android Studio - Failed to find Build Tools revision 27.1.0Gradle 项目同步失败 - Android Studio - 找不到构建工具修订版 27.1.0
【发布时间】:2018-12-25 19:36:01
【问题描述】:

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.android.sqliteapp"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
        }
    }
    buildToolsVersion '27.1.0'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.2'
}

发生错误

FAILURE:构建失败并出现异常。

  • 出了什么问题: 配置项目 ':app' 时出现问题。

    未能找到构建工具修订版 27.1.0

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

配置在 2 秒内失败 找不到构建工具修订版 27.1.0

build.gradle

buildscript {

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

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

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

【问题讨论】:

    标签: android gradle


    【解决方案1】:

    将此代码放入您的 build.gradle(应用级别)

    allprojects {
        repositories {
            jcenter()
            google()
            maven {
                url 'https://maven.google.com'
            }
    
        }
    

    }

    【讨论】:

      猜你喜欢
      • 2019-03-12
      • 2016-12-11
      • 1970-01-01
      • 2016-07-01
      • 1970-01-01
      • 2016-12-18
      • 2013-12-10
      • 2020-10-27
      • 2014-07-03
      相关资源
      最近更新 更多