Android应用开发之MPAndroidChart无法引入依赖的问题解决办法
白羽 2018-09-14 来源 :网络 阅读 1216 评论 0

摘要:本文将带你了解Android应用开发之MPAndroidChart无法引入依赖的问题解决办法,希望本文对大家学Android有所帮助

        本文将带你了解Android应用开发之MPAndroidChart无法引入依赖的问题解决办法,希望本文对大家学Android有所帮助


刚刚犯了一个低级错误。
引用 MPAndroidChart 这个开源的图表库的时候,按照官方的提示去引入依赖库,结果同步的时候,怎么都编译不过。
提示的信息就是:
Failed to resolve: com.github.PhilJay:MPAndroidChart:v3.0.2
可我记得自己明明就按照配置说明进行的配置的啊。
先看官方文档。

然后,再比较自己的配置文件。
buildscript { repositories {  jcenter()  maven { url "https://jitpack.io" } } dependencies {  classpath 'com.android.tools.build:gradle:2.2.0'   // NOTE: Do not place your application dependencies here; they belong  // in the inpidual module build.gradle files }} allprojects { repositories {  jcenter()  }} task clean(type: Delete) { delete rootProject.buildDir} dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {  exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.0.1' compile 'com.github.PhilJay:MPAndroidChart:v3.0.2' testCompile 'junit:junit:4.12'}
初看,没有什么问题。但就是编译不通过,百思不得其解。
但是后来看到stackoverflow上的答案时,才明白了错误所在。
我将
maven { url "https://jitpack.io" }
这一句错误地放置在了 buildscript{} 中,正确的应该是这样的。
buildscript { repositories {  jcenter() } dependencies {  classpath 'com.android.tools.build:gradle:2.2.0'   // NOTE: Do not place your application dependencies here; they belong  // in the inpidual module build.gradle files }} allprojects { repositories {  jcenter()  maven { url "https://jitpack.io" } }} task clean(type: Delete) { delete rootProject.buildDir}
看来,写程序还是要细心为好,小小的一个失误有时候会让你怀疑人生。    

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标移动开发之Android频道!

本文由 @白羽 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved