hellocharts的GitHub地址
https://links.jianshu.com/go?to=https://github.com/lecho/hellocharts-android/
在跟着README导入jar包,代码如下
dependencies{
compile 'com.github.lecho:hellocharts-library:1.5.8@aar'
}
会得到错误
Could not find method compile() for arguments [com.github.lecho:hellocharts-library:1.5.8@aar]
手动将jar包复制到项目libs中并Add as Library后成功了,但是在xml文件中添加以下代码后仍报错
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="160dp"
android:layout_height="100dp"
/>
报错:
Class referenced in the layout file,
lecho.lib.hellocharts.view.LineChartView
, was not found in the project or the libraries
解决方式:
将compile用implementation替换
dependencies{
implementation 'com.github.lecho:hellocharts-library:1.5.8@aar'
}