MPAndroidChat加载依赖总是失败

1.问题描述

新项目中添加MPAndroidChart依赖,总是加载不上,可能是网络原因。
Failed to resolve: com.github.PhilJay:MPAndroidChart:v3.1.0
Show in Project Structure dialog
Affected Modules: app
在这里插入图片描述
在这里插入图片描述

2.解决办法

众所周知,Android通过gradle下载的依赖会存放在
C:\Users\MSI.gradle\caches\modules-2\files-2.1目录下
在这里插入图片描述
那么我们可以将MPAndroidChart依赖文件MPAndroidChart-v3.1.0.aar放到app/libs下,libs文件夹需要自己创建
在这里插入图片描述
然后在build.gradle(:app)中加上implementation(fileTree("libs"))
如下所示:

dependencies {
    implementation 'com.daimajia.swipelayout:library:1.2.0'
    implementation 'com.kyleduo.switchbutton:library:2.1.0'
    //记得将原来的注释掉不然还是去下载,而不是我们添加的本地的依赖了
	// implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
	
    implementation(fileTree("libs"))//要加上这一句,才能加载本地的依赖
    
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    implementation 'com.google.code.gson:gson:2.10.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

3.依赖文件分享

我已经打包MPAndroidChart v3.1.0了需要的自取
在这里插入图片描述

https://wwb.lanzouo.com/ir0k91uqkm7c

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值