Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.1.4

*爱你&永不变心* 提交于 2019-11-27 13:25:40

Add

maven { url "https://jitpack.io" }

to repositories under allprojects not under buildscript see screenshot:

Putting

repositories {
    maven { url "https://jitpack.io" }
}

in build.gradle in app folder fixed my issue!

Nafeez Quraishi

Above solutions did not work for me. I used below to get MPAndroidChart lib working on my project.

  1. Downloaded the latest MPAndroidChart jar from: https://jitpack.io/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar

  2. Copied the downloaded MPAndroidChart-v3.0.1.jar file to YourProject/app/lib directory

  3. Compiled the following dependency at app level build.gradle

    dependencies {
    
        compile files('libs/MPAndroidChart-v3.0.1.jar')
    
    }
    
  4. re-sync the gradle

Go to build.gradle Add the maven { url 'https://jitpack.io' } in both buildscript{} and allprojects{} as below :

buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}



allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Remember to Sync.

pRaNaY

The problem was solved after restarting Android Studio > rebuild project.

In Settings Gradle just add this following code:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
Chinthaka Devinda

I had the same problem after adding this one in the gradle solved my problem:

    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }

`

For me the issue was resolved by placing code in below order.

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.google.com" }
    }
}
rand100500ify

https://stackoverflow.com/a/29742712 The JitPack repository shouldn't be under buildscripts in this case. It should be just under repositories:

You could encounter this issue if your gradle offline mode is enabled.

turn it off in android studio, Settings > Gradle and uncheck "Offline work" and sync.

One Problem can also be, that you are behind a proxy. So there are two possibilities: Add your proxy config to android Studio, ore you can also add a gradle.properties file in your project root. there you have to enter the following credentials:

    systemProp.http.proxyPassword=
    systemProp.http.proxyHost=
    systemProp.http.proxyUser=
    systemProp.http.proxyPort=
    systemProp.https.proxyPassword=
    systemProp.https.proxyHost=
    systemProp.https.proxyUser=
    systemProp.https.proxyPort=

So the https Properties are pretty necessary. I figured out that often the repositories are available over both protocols. but sometimes only over http or https.

Or just rebuild your project. Worked for me

Run gradle wrapper task from command line

cd ~/AndroidStudioProject/myproject/myapp
./gradlew tasks

This worked for me. If your under proxy add this lines in gradle properties(project properties)

systemProp.http.proxyHost= "Your proxy"
systemProp.http.proxyPort= "Proxy port"
systemProp.https.proxyHost= "Your proxy"
systemProp.https.proxyPort= "Proxy port"

Build-> Rebuild the project, then re-sync the gradle file.

I had to move maven { url 'https://jitpack.io' } to be the last declaration after google(), and jcenter().

The JitPack repository shouldn't be under buildscripts in this case. It should be just under repositories:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!