I add MPAndroidChart in my project but in my xml I cant find LineChart

Viewed 808

I want to use MPAndroidChart in my project.
I add that library in my gradle but in my xml layout file, I cant find Chart.
my build.gradle(Module) is this :

dependencies {

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

and build.gradle(Project) is this :

// 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.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

but I cant find Chart in my xml layout file enter image description here

2 Answers

Add the maven { url 'https://jitpack.io' } in setting.gradle file instead of build.gradle(Project)

need to add maven url in setting.gradle add code like this .

pluginManagement {
repositories {
    gradlePluginPortal()
    google()
    mavenCentral()
    maven { url 'https://jitpack.io' }
 }
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    maven { url 'https://jitpack.io' }
 }
}
Related