Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.1.4
I'm using MPAndroidChart
library in android studio. But when I'm trying to sync gradle I get an error as shown in below image.
Gradle text is here to compile MPAndroidChart
library.
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
How can I resolve this problem?
Add
maven { url "https://jitpack.io" }
to repositories under allprojects not under buildscript see screenshot:
Above solutions did not work for me. I used below to get MPAndroidChart lib working on my project.
Downloaded the latest MPAndroidChart jar from: https://jitpack.io/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
Copied the downloaded MPAndroidChart-v3.0.1.jar file to YourProject/app/lib directory
-
Compiled the following dependency at app level build.gradle
dependencies { compile files('libs/MPAndroidChart-v3.0.1.jar') }
re-sync the gradle
Putting
repositories {
maven { url "https://jitpack.io" }
}
in build.gradle in app folder fixed my issue!
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
.
The problem was solved after restarting Android Studio > rebuild project.