'Cannot resolve class com.github.mikephil.charting.charts.BarChart, MPAndroidChart
What's going on? Got all guide but I have this error.
- Class referenced in the layout file, - com.github.mikephil.charting.charts.BarChart, was not found in the project or the libraries
- Cannot resolve class com.github.mikephil.charting.charts.BarChart 
Did I forget something? Does it need more implementation?
My Project:
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.2"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"
    }
}
allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
My Module:
dependencies {
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
My XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <com.github.mikephil.charting.charts.BarChart
        android:id="@+id/fragment_verticalbarchart_chart"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
I get here the error
Solution 1:[1]
In build.gradle(:app) add this:
dependencies {
  //chart
  implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
  ...
}
And In settings.gradle add maven { url "https://jitpack.io" }
dependencyResolutionManagement {
 repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
 repositories {
    google()
    mavenCentral()
    maven { url "https://jitpack.io" } // add this line
 }  
}
Solution 2:[2]
In settings.gradle add maven { url "https://jitpack.io" }. Invoking menu File -> Sync Project with Gradle Files.
Solution 3:[3]
I had the same problem and fixed it by adding maven { url "https://jitpack.io"}
in setting Gradle and it worked fine
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | |
| Solution 2 | Enrico | 
| Solution 3 | Henry Ecker | 
