简体   繁体   English

Android Studio 3.0 Gradle同步失败,返回Google App Engine错误

[英]Android Studio 3.0 Gradle sync fails ,returns google app engine error

I upgraded to Android Studio 3.0 and after importing my project,Gradle fails to sync.Here is my gradle config. 我升级到Android Studio 3.0,并在导入项目后,Gradle无法同步。这是我的gradle配置。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.xxxxx.xxxx"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),    'proguard-rules.pro'
          } 
    }
}

The gradle fails sync and returns this error: gradle同步失败并返回此错误:

Error:com/google/appengine/gradle/model/AppEngineModelcom/google/appengine/gradle/model/AppEngineModel

Here is the Project gradle config file. 这是Project 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'
    }
}

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

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

What could be the problem? 可能是什么问题呢?

Just try this one, 试一试

add below lines on Gradle file 在Gradle文件中添加以下行

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

Make sure your Project level Gradle file is with google() Repo. 确保您的项目级Gradle文件位于google()

here is the sample 这是样本

buildscript {

    repositories {
        google() // make sure this repo. is in your gradle
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        google() // make sure this repo. is in your gradle
        jcenter()
    }
}

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

我重新安装了Android Studio 3.0.1,一切正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM