1.在app的build.gradle中添加加粗部分
dependencies { implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2' }
2.在setting.gradle中添加加粗部分
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" } } }
3.在布局文件中就可以使用了
<com.github.mikephil.charting.charts.LineChart android:id="@+id/LineChart_content_temp_module_debug_ch1" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="visible" />