0

Hi all i am using charts library in my project a month ago it was working fine but now i have reinstalled android studio and when i build my project it gives gradle sync error.

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

I am stuck on this any suggestions how to solve this.My android studio version is 2.1

Here is project dependencies

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.app.comismv"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.3'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
    //compile 'com.cardiomood.android:android-widgets:0.1.1'
}

Thanks in advance

Hassan Shahbaz
  • 596
  • 1
  • 14
  • 38
  • 1
    Question is already here: http://stackoverflow.com/questions/32718820/failed-to-resolve-com-github-philjaympandroidchartv2-1-4 Try this: http://stackoverflow.com/a/37892027/1293313 – ᴛʜᴇᴘᴀᴛᴇʟ Aug 31 '16 at 13:12
  • `url "https://jitpack.io"` should be in your higher level build.gradle file. not in the application `build.gradle` – ᴛʜᴇᴘᴀᴛᴇʟ Aug 31 '16 at 13:15
  • I have added these lines in build.gradle but it does not solve – Hassan Shahbaz Aug 31 '16 at 13:23
  • @HassanShahbaz You're adding the Jitpack repository to the app Gradle script, that's because your build is not solving the dependency. You need to add it to the project Gradle DSL. They are different build.gradle files in your project tree. – Martin Revert Sep 01 '16 at 02:32

1 Answers1

1

I had the same problem, here is the latest version of MPAndroidChart-v2.2.5.jar jar file.

Just put the MPAndroidChart-v2.2.5.jar inside app/libs/

and add

dependencies {
    .
    .
    compile files('libs/MPAndroidChart-v2.2.5.jar')
} 

in gradle file

Nishant Pardamwar
  • 1,450
  • 12
  • 16