简体   繁体   English

android 的所有图表库都不起作用

[英]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我正在使用最新版本的 android 工作室我尝试遵循从不同库( AnyChartMpAndroidChartGruzer )在我的项目中添加图表所需的所有步骤,但它们都不起作用我最终得到了红线错误

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这是我的 gradle 应用程序文件依赖项

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如果不起作用...检查您的 Internet 连接并尝试其他依赖项,例如 retrofit 以确保您的 gradle 同步也能正常工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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