Gradle Build Error: Cannot load Maven metadata from https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml

I get a Gradle build error in Android Studio as shown below:

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 

I found that the "https" tag does not work to load the Maven URL, so I changed https to http in my build.gradle file. I also checked all the gradle settings and manually changed the other.xml file along the path C: \ Users \ Ashfaque1.AndroidStudio \ config \ options \, but still it accepts https://repo1.maven.org/maven2/io/fabric/ tools / gradle / maven-metadata.xml . Also, as soon as I click this link to the browser, I get 404 exception, but the second URL with the error http://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml , I can successfully search and load the metadata file correctly on my system. I can’t understand what the problem is, where I need to change the settings so that the metadata file is loaded. Please suggest if I need to change any settings or where does it get this URL https://repo1.maven.org/maven2//io/fabric/tools/gradle/maven-metadata.xml

My build.gradle file is as follows:

  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" } } 
+11
java android android-studio android-gradle maven android-gradle-plugin
source share
4 answers

if you still have problems building gradle after viewing all the topics in Stack, as I did in the last two days, there might be something else that you should check, if you used Proxy before, there are two files with named gradle.properties in your Gradle package.

if you used a proxy before the opportunity arose that android studio would add this information to one of these gradle.properties files, so take a look at both of them, and if you see something like:

 systemProp.https.proxyHost=your_proxy_host systemProp.https.proxyPort=your_proxy_port systemProp.https.proxyUser=your_proxy_username systemProp.https.proxyPassword=your_proxy_password 

or

 systemProp.http.proxyHost=your_proxy_host systemProp.http.proxyPort=your_proxy_port systemProp.http.proxyUser=your_proxy_username systemProp.http.proxyPassword=your_proxy_password 

just delete them, then invalidate the cache and restart your android studio and run the project, I'm sure you will be fine.

+5
source

1) You should synchronize with remote repositories, with something like

mvn install - U

or in Android Studio or IntelliJ Idea go to Settings find the Maven group, find the Repositories subgroup and click Update on repo.

enter image description here

2) If you do not need to switch to jcenter() instead of mavenCentral() , because fabric.io developers, by pushing updates to jcentral() and mavenCentral() , can become obsolete. Learn more about the difference between the two: Android buildscript repositories: jcenter VS mavencentral

+2
source

This can happen if you are behind a proxy server.

0
source

Turn on

Offline work

in settings -> Build, Execution ... -> Gradle

0
source

All Articles