Mpandroidchart: Unable to import library via Gradle

Created on 29 Jan 2016  路  31Comments  路  Source: PhilJay/MPAndroidChart

I'm trying to import library like said in Usage section in my Android project.
I'm currently using Gradle, ofc.

This is a piece of my build.gradle

[...]
repositories {
        maven { url 'http://repo1.maven.org/maven2' }
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.github.PhilJay:MPAndroidChart:v2.2.0'
}

and this is the error I got:
schermata 2016-01-29 alle 15 29 15

I'm not new to importing new dependencies to my project and I really need to say that this is the first time I can't include a new dependency in this way....

On the other side, including JAR library in lib folder does the trick.

Most helpful comment

This SO answer may help us all http://stackoverflow.com/a/37892027/1293313

All 31 comments

try an older version, for example I'm using 2.1.6

Weird. I just tired it with v2.2.0 - works just fine for me, maybe it was just a temporary issue with jitpack?

same issue on 2.2.2

Just tested it again with a completely new project.

Had no issues resolving v2.2.2

If it's of any help I had the dependency declaration in the wrong part of the gradle file - my bad.

@sachams where do you place the dependency declaration and what version are using?

I am unable to resolve v2.2.4 via jitpack..

Strange. Running "sync now" in android studio 1.5 results in resolving errors. After running gradle from command line (e.g. ./gradlew tasks), everything works fine in android studio too...

@derSascha champion answer.

Steps I took:

  1. Change distributionUrl in gradle-wrapper.properties to the latest gradle
  2. Run gradle wrapper task from command line
cd ~/AndroidStudioProject/myproject/ myapp
./gradlew tasks

Profit

Hi phil,

I lost at least two days to compile MPAndroidChart in my Android studio it says that failed to resolve 'com.github.PhilJay:MPAndroidChart:v2.2.3' i am using Android studio 1.4 please respond me as soon as possible how i syn it in android studio ..

Thanks

Add the jitpack repository:

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

I already added it but not compile till

Thanks a lot phil it works for me ... and one more thing i want to customize the graph putting integer value on x axis and y axis plese help me

@ashutosh5889 A good skill to learn is reading documentation, you should try it.

if you have any link regarding this documentation then send me

It seems you want everything just handed to you on a silver platter. But life doesn't work that way.

This SO answer may help us all http://stackoverflow.com/a/37892027/1293313

// Add the jitpack repository:
// to repositories under allprojects not under buildscript see screenshot:

allprojects {

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

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

I was getting the same error, despite my build files being correct. After I updated android studio, and rebuilt the project, this error was removed.

I got the exact same error. I couldn't figure out why i was getting the error, but a guy in my office hit
'Build' > 'Make Project' (even when the error was showing) and it synced like magic . . . .. . weird

Phill can you provide the latest .jar file because i am facing some problems to resolve the dependencies

Error:(27, 24) Failed to resolve: com.github.PhilJay:MPAndroidChart:v3.0.0

I am getting the same problem again with this library.
screenshot from 2017-02-06 18-38-48

MPAndroidChart-v3.0.1.zip
try with the JAR

I can try with the JAR but do you know why is this problem coming in the first place? Its working for my colleague sitting next to me but not for me.

I was facing this problem because of some site restrictions in my office
might be the same issue with you..else i don't know

I don't think that's it. The guy sitting next to me was using the same wifi but it worked for him. Thanks anyway.

not able to add dependency in compile sdk version 25
is there any problem withsdkversion

The graph does not show in android 26 version, there looking blank screen

skaermbillede 2018-01-05 kl 03 23 45

Guys, remember to add the maven { url "https://jitpack.io" } inside of allprojects/repositories !

Please add below code in gradle file:

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

implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'

}

The path /home/sai/AndroidStudioProjects/AndroidRetrogit does not exist.
If it is on a removable or network drive, please make sure that the drive is connected.

when i try to open my previous work space in android studio it has shown above message.
anybody tell me please

i am stuck ??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChenZeFengHi picture ChenZeFengHi  路  3Comments

vishvendu picture vishvendu  路  3Comments

botondbutuza picture botondbutuza  路  3Comments

JungYongWook picture JungYongWook  路  3Comments

AiTheAnswer picture AiTheAnswer  路  3Comments