Gradle 构建错误:无法从 https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml 加载 Maven 元数据
我在Android工作室中收到一个gradle构建错误,如下所示:
Error:A problem occurred configuring project ':MyApp'.
Could not resolve all dependencies for configuration ':MyApp:classpath'.
Could not resolve io.fabric.tools:gradle:1.+.
Required by:
sw-android:MyApp:unspecified
Failed to list versions for io.fabric.tools:gradle.
Unable to load Maven meta-data from
https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml.
Could not GET 'https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml'.
peer not authenticated
Failed to list versions for io.fabric.tools:gradle.
Unable to load Maven meta-data from
http://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml.
Could not GET http://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml'.
peer not authenticated
我发现“https”标签无法下载Maven URL,因此我在build.gradle文件中将https更改为http。此外,我检查了所有的gradle设置并手动修改了路径C:\Users\Ashfaque1.AndroidStudio\config\options\中的另一.xml文件,但它仍然采取了 https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml。此外,一旦我点击浏览器的此链接,我就会得到404异常,但错误 http://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml 中的第二个URL,我能够成功点击并在我的系统中正确下载元数据文件。无法理解问题所在,我需要更改设置才能下载元数据文件。请建议我是否需要更改任何设置或从中获取此URL的位置 https://repo1.maven.org/maven2//io/fabric/tools/gradle/maven-metadata.xml
我的 build.gradle 文件如下:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
mavenCentral()
maven { url 'http://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
maven { url 'http://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(dir: 'libs',include: '*.jar')
compile project(':DeviceService')
compile project(':RatioCommon')
compile project(':SlidingMenu:library')
compile project(':SmartViewLibrary:SmartView')
compile project(':SmartViewLibrary:OpenAccess')
compile('com.crashlytics.sdk.android:crashlytics:2.2.0@aar') {
transitive = true;
}
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
}