【问题标题】:Gradle build failing for Google Cloud Module谷歌云模块的 Gradle 构建失败
【发布时间】:2015-09-23 10:06:55
【问题描述】:

我使用 Google 云模块创建了一个项目。在构建时,我是对等未通过身份验证的错误。

接下来我将jcenter 替换为mavenCentral() 并能够下载并添加appengine-sdkappengine-endpoints,appengine-endpoints-dep

完成所有这些构建后,失败并显示以下错误消息。

Error:Failed to resolve: com.google.api-client:google-api-client-android:1.19.0

卡在这一点上。请帮忙解决这个问题

提前致谢

    buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}

}

repositories {
mavenCentral();
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile 'com.google.appengine:appengine-endpoints:1.9.18'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
compile 'javax.servlet:servlet-api:2.5'
}

appengine {
downloadSdk = true
appcfg {
    oauth2 = true
}
endpoints {
    getClientLibsOnBuild = true
    getDiscoveryDocsOnBuild = true
}

}

【问题讨论】:

  • 发布你的 build.gradle
  • 接下来我用 mavenCentral() 替换了 jcenter 为什么? jcenter 是 maven 的超集
  • 使用 jcenter() 时出现 peer not authenticated 错误。

标签: android google-app-engine android-gradle-plugin


【解决方案1】:

接下来我用 mavenCentral() 替换了 jcenter

我不知道你为什么这样做。 Jcenter 是 mavenCentral 的超集,这基本上意味着它可以做同样的事情,甚至更多。

您在cmets中命名的对等身份验证错误应使用this solution解决,然后您可以正常进行。

以下是用于同步 google-api-client-android:1.19.0 的最小工作设置:

项目 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

App build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "xxxx"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.google.api-client:google-api-client-android:1.19.0'
}

android{ } 部分中的值不必相同,但其余部分很重要。

另请注意,还有一个更新版本的 google-api-client-android,即 1.20.0

【讨论】:

  • 感谢您的帮助。解决方案:在项目 build.gradle 文件中将 jcenter 替换为 mavenCentral。
猜你喜欢
  • 2020-05-21
  • 1970-01-01
  • 2018-05-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-24
  • 2017-09-12
  • 1970-01-01
相关资源
最近更新 更多