Failed to resolve: com.github.PhilJay:MPAndroidCha

2019-01-14 10:37发布

I am using MPAndroidChart libarary in android studio.But when i am trying to sync gradle which given an error as below image. Gradle text is here to compile MPAndroidChart libarary.

compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'

Error screenshot

Please help to resolve this problem. Thanks in advance

14条回答
淡お忘
2楼-- · 2019-01-14 11:05

Or just rebuild your project. Worked for me

查看更多
forever°为你锁心
3楼-- · 2019-01-14 11:10

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.

查看更多
smile是对你的礼貌
4楼-- · 2019-01-14 11:10

In Settings Gradle just add this following code:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-01-14 11:11

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

查看更多
一夜七次
6楼-- · 2019-01-14 11:13

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

查看更多
手持菜刀,她持情操
7楼-- · 2019-01-14 11:15

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

查看更多
登录 后发表回答