简体   繁体   中英

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.

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:

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

Here is the Project gradle config file.

// 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

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

Make sure your Project level Gradle file is with google() Repo.

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,一切正常

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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