Question: community, I am trying to implement MPAndroidChart in my android app using java language but android studio returns an error when I sync the project.

> 
> Could not find com.github.PhilJay:MPAndroidChart:v3.1.0.Required by: project :app
> 
> 
> 

I have already put the put de dependencies in my build.gradle(app) file like bellow:

```
dependencies {
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}

```

and add the repository:

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

```

I have tried also to implement all the solutions proposed [here](https://stackoverflow.com/questions/32718820/failed-to-resolve-com-github-philjaympandroidchartv2-1-4) but always error even after restarting android studio, cleaning project,...
So I need help, please.

Answer: 
I have solved this issue by following the instruction post in the [Github issues](https://github.com/PhilJay/MPAndroidChart/issues/1918) for this project
To solve this, you need just to add the bellow code in your settings.gradle

```
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
        maven { url 'https://jitpack.io' } //Add this line in your settings.gradle
    }
}

```

And also don't forget to implement the library in you build.gradle (app level)

```
dependencies {
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}

```
As crazy4dev says

I also have to add

build.gradle (Project)

```
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.4"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
    }
}

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

```

build.gradle (Module)

```
dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // MPAndroidChart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}

```

Finaly
settings.gradle

```
import org.gradle.api.initialization.resolve.RepositoriesMode

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
        maven { url 'https://jitpack.io' } //Add this line in your settings.gradle
    }
}
rootProject.name = "AppName"
include ':app'

```