【问题标题】:Android Studio 3.0 Gradle sync fails ,returns google app engine errorAndroid Studio 3.0 Gradle 同步失败,返回谷歌应用引擎错误
【发布时间】:2018-06-20 10:44:26
【问题描述】:

我升级到 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

这是项目 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 文件的代码。

标签: java android google-app-engine gradle


【解决方案1】:

试试这个,

在 Gradle 文件中添加以下行

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

【讨论】:

  • 同样的问题:)
【解决方案2】:

确保您的项目级 Gradle 文件包含 google() Repo。

这里是示例

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
}

【讨论】:

  • 同样的错误,我目前在中国,他们屏蔽了谷歌,这可能是个问题吗?
  • 使用 VPN 取消阻止。
【解决方案3】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-30
    相关资源
    最近更新 更多