简体   繁体   中英

All Charts libraries for android does not work

I'm using latest version of android studio i tried to follow all steps required for adding Charts in my project from different Libraries( AnyChart , MpAndroidChart , Gruzer ) but none of them work i ended up with red lines erros

so how can i solve this?

Here is my gradel file

  buildscript {
        repositories {
            google()
            mavenCentral()
            maven { url 'https://jitpack.io' }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:7.0.3"
        classpath 'com.google.gms:google-services:4.3.10'

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

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

Here is my gradle app file dependencies

dependencies {

implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation platform('com.google.firebase:firebase-bom:29.0.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.github.Gruzer:simple-gauge-android:0.3.1'
implementation 'com.github.AnyChart:AnyChart-Android:1.1.2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

}

Here is my main activity file,i get same problem to all Libraries. enter image description here

this work for me

dependencies {

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

    }


buildscript {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
        classpath 'com.google.gms:google-services:4.3.5'

    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
        maven {
            url "https://s3.amazonaws.com/repo.commonsware.com"
        }
    }
}

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


if not worked... check your internet connection and try another dependencies like retrofit to make sure your gradle sync work as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM