之所以写这篇博客,不是为了别的,主要是我自己在实现图表过程中,感觉真的挺困难的,虽然网上已经有很多种方法了,我的方法也并非我自己原创的,但是我还是想把我的一些经验分享给大家吧,因为是新手,所以更加懂得新手们缺的是什么,为什么那么多方法还是实现不了,下面,请听我一一道来。
首先,点击打开Gradle Scripts,如下图:
双击打开build.gradle(Project:xxxxx),在allprojects ->repositories中添加如下代码:
maven { url https://jitpack.io }
我添加完成后的代码是这样的:
allprojects {
repositories {
google()
jcenter()
maven { url https://jitpack.io }
}
}
google()、jcenter()都是一开始就存在的。
再双击打开build.gradle(Module:app),在dependencies中添加如下代码:
implementation com.github.PhilJay:MPAndroidChart:v3.0.3