1

When building, Gradle gave me the Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.2.4 error.

I already added jitpack in build.gradle here:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'aar'
        }
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is based here. What am I missing?

Community
  • 1
  • 1
Compaq LE2202x
  • 2,030
  • 9
  • 45
  • 62

3 Answers3

1

Please check if you added below plugin in your build.gradle where you add dependancy of
compile 'com.github.PhilJay:MPAndroidChart:v2.2.4' "apply plugin: 'maven'"

0

Switch to the latest version:

compile 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'

And always use information for the main source - in this case MPAndroidChart Github Repo Readme.MD

If behind a proxy configure your proxy settings in gradle.properties as follows:

systemProp.http.proxyHost=103.7.11.34
systemProp.https.proxyPort=8080
systemProp.https.proxyHost=103.7.11.34
systemProp.http.proxyPort=8080

Note: IP address and port in the lines above to be replaced by your proxy server ip address (or url) and port

Viral Patel
  • 32,418
  • 18
  • 82
  • 110
-1

Did you add the following in your root build.gradle file: if not then add this.

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

And Restart Android Studio and Rebuild your project.

I have faced same problem the problem was solved after restarting android studio --> rebuild project.

Also if not solved with above you may change the version of distributionUrl in gradle-wrapper.properties to the available newest.

Community
  • 1
  • 1
Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
  • You can directly point to existing posts instead of copying and pasting answers and causing duplication - Source of text above - http://stackoverflow.com/questions/32718820/failed-to-resolve-com-github-philjaympandroidchartv2-1-4?noredirect=1&lq=1 – Viral Patel Jul 28 '16 at 06:00