JCenter 为 Play 服务抛出 409
JCenter throwing 409 for Play Services
我今天一直在尝试导入一个 android 项目,但始终无法完成。 Gradle一直在抱怨
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'
好的,知道了。转到您的 顶级 gradle 文件 并确保每个地方都有一个 repositories
子句,即 google()
是第一个 repo。
repositories {
google()
jcenter()
... etc ...
}
我不太确定为什么这个突然出现,但是将 Google 存储库移到顶部为我修复了它。
我遇到了同样的问题,通过如下删除 maven url 解决了这个问题。
我今天一直在尝试导入一个 android 项目,但始终无法完成。 Gradle一直在抱怨
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'
好的,知道了。转到您的 顶级 gradle 文件 并确保每个地方都有一个 repositories
子句,即 google()
是第一个 repo。
repositories {
google()
jcenter()
... etc ...
}
我不太确定为什么这个突然出现,但是将 Google 存储库移到顶部为我修复了它。
我遇到了同样的问题,通过如下删除 maven url 解决了这个问题。