首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >MPAndroidChart v3.1.0在github上找不到

MPAndroidChart v3.1.0在github上找不到
EN

Stack Overflow用户
提问于 2021-12-12 09:43:27
回答 2查看 2K关注 0票数 2

社区中,我试图使用java语言在我的安卓应用程序中实现MPAndroidChart,但是android在同步项目时会返回一个错误。

找不到com.github.PhilJay:MPAndroidChart:v3.1.0.Required : project :app

我已经将put de依赖项放在我的build.gradle(app)文件中,如下所示:

代码语言:javascript
运行
复制
dependencies {
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}

并添加存储库:

代码语言:javascript
运行
复制
repositories {
    maven { url 'https://jitpack.io' }
}

我也试图实现所有的解决方案提出的这里,但始终错误,即使在重启安卓工作室,清洁项目,……所以我需要帮助拜托。

EN

回答 2

Stack Overflow用户

发布于 2021-12-12 10:56:47

为了解决这个问题,我按照Github问题中的指令来解决这个问题,您只需要在您的settings.gradle中添加下面的代码

代码语言:javascript
运行
复制
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
    }
}

还不要忘记在您的build.gradle (应用程序级别)中实现库。

代码语言:javascript
运行
复制
dependencies {
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
票数 4
EN

Stack Overflow用户

发布于 2022-01-12 00:15:21

正如crazy4dev所说

我还得加上

build.gradle (项目)

代码语言:javascript
运行
复制
// 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 (模块)

代码语言:javascript
运行
复制
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'
}

最后settings.gradle

代码语言:javascript
运行
复制
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'
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70322414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档