簡體   English   中英

Android Studio 3.0 Gradle同步失敗,返回Google App Engine錯誤

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

我升級到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'
          } 
    }
}

gradle同步失敗並返回此錯誤:

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

這是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
}

可能是什么問題呢?

試一試

在Gradle文件中添加以下行

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

確保您的項目級Gradle文件位於google()

這是樣本

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