代码之家  ›  专栏  ›  技术社区  ›  Premsuraj

jcenter为play服务抛出409

  •  1
  • Premsuraj  · 技术社区  · 8 年前

    我今天一直在尝试导入一个android项目,但一直没有完成。格雷德一直在抱怨

    Could not HEAD 'https://jcenter.bintray.com/com/google/android/gms/play-services-base/11.4.2/play-services-base-11.4.2.pom'. Received status code 409 from server: 
    

    我试着跟踪日志中的url,它重定向到 https://jcenter.bintray.com/com/google/android/gms/play-services-base/11.4.2/play-services-base-11.4.2.pom 然后给出下面的响应。

    {
      "errors" : [ {
        "status" : 409,
        "message" : "Failed to read POM for 'com/google/android/gms/play-services-base/11.4.2/play-services-base-11.4.2.pom': expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</dependencies>\\n \\ua0<l... @30:5) ."
      } ]
    }
    

    我不知所措。为什么会发生这种事,我能做些什么来解决?

    项目build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'com.google.gms:google-services:3.1.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    allprojects {
        repositories {
            jcenter()
            maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
            maven { url "https://jitpack.io" }
            google()
        }
    }
    

    app/build.gradle版本

    buildscript {
        repositories {
            jcenter()
            maven { url 'https://www.testfairy.com/maven' }
        }
        dependencies {
            classpath 'com.testfairy.plugins.gradle:testfairy:1.12'
            classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.6.0'
            classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.11.+"
    //        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.5'
            classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
        }
    }
    
    apply plugin: 'com.android.application'
    apply plugin: 'testfairy'
    apply plugin: 'org.moallemi.advanced-build-version'
    apply plugin: "build-time-tracker"
    apply plugin: 'com.getkeepsafe.dexcount'
    //apply plugin: 'io.fabric'
    
    dexcount {
        format = "list"
        includeClasses = false
        includeFieldCount = true
        includeTotalMethodCount = true
        orderByMethodCount = true
        verbose = false
        maxTreeDepth = Integer.MAX_VALUE
        teamCityIntegration = false
    //    enableForInstantRun = false
    }
    
    advancedVersioning {
        nameOptions {
            versionMajor 1
            versionMinor 11
            versionPatch new Date().format('yyMMdd') as int
            versionBuild versionCode
        }
        codeOptions {
            versionCodeType org.moallemi.gradle.internal.VersionCodeType.DATE
            //dependsOnTasks 'testfairy', 'release' //, 'assemble'
        }
        outputOptions {
            renameOutput true
            nameFormat '$projectName-$buildType-$versionName'
        }
    }
    
    android {
        aaptOptions {
            noCompress 'png', 'wav'
        }
        compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
        buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
    
        defaultConfig {
            applicationId "xxx.xxx"
    //        testApplicationId "com.airbeem.airbeemsimulator"
            minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
            targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
            versionCode advancedVersioning.versionCode //67
            versionName advancedVersioning.versionName //"4.10-${new Date().format('yyMMdd')}"
            multiDexEnabled true
        }
    
        signingConfigs {
            release {
                storeFile file('xxx')
                storePassword 'xxx'
                keyAlias 'xxx'
                keyPassword 'xxx'
                v2SigningEnabled true
            }
            debug.initWith(signingConfigs.release)
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                signingConfig signingConfigs.release
            }
        }
    
        lintOptions {
            abortOnError false
        }
    
        dexOptions {
            preDexLibraries = false
            javaMaxHeapSize "8g"
        }
    
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
            exclude 'META-INF/rxjava.properties'
    
            exclude 'error_prone/Annotations.gwt.xml'
            exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
            exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
        }
    
        testfairyConfig {
            apiKey "xxx"
            iconWatermark true
            testersGroups "android"
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile project(':xxx')
    }
    
    buildtimetracker {
        reporters {
            summary {
                ordered false
                threshold 50
                barstyle "unicode"
            }
        }
    }
    
    // ADD THIS AT THE BOTTOM
    apply plugin: 'com.google.gms.google-services'
    
    2 回复  |  直到 8 年前
        1
  •  2
  •   Lisa Wray    8 年前

    好吧,明白了。去你的 顶级渐变文件 确保你在任何地方 repositories 条款 google() 是第一次回购。

    repositories {
        google()
        jcenter()
        ... etc ...
    }
    

    我真的不知道为什么这一次突然成功了,但把谷歌回购推到了最上面,帮我解决了这个问题。

        2
  •  0
  •   Fahim Parkar    8 年前

    我有同样的问题,这是通过删除maven url解决的,如下所示。

    https://oss.sonatype.org/content/repositories/snapshots/