我将pathview
添加到了gradle中:
implementation('com.eftimoff:android-pathview:1.0.8@aar')
并按如下所示使用它:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/splashBackgroundColor"
tools:context=".SplashActivity">
<com.eftimoff.androipathview.PathView
android:id="@+id/pathView"
android:layout_width="300dp"
android:layout_height="300dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:svg="@raw/youtubelogo" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
和
val binding :ActivitySplashBinding =
DataBindingUtil.setContentView(this, R.layout.activity_splash)
val pathView = binding.pathView
pathView.pathAnimator
.delay(1000)
.duration(1000)
.interpolator(AccelerateDecelerateInterpolator())
.start()
当我运行应用程序时,一切都很好,并且应用程序已启动。现在我想使用滑行,所以我将滑行库添加到了gradle中:
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
但是在运行应用程序时添加了glide库之后,出现了此错误:
Process: com.tazik.moviedb, PID: 10642
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tazik.moviedb/com.tazik.moviedb.SplashActivity}: java.lang.IllegalStateException: binding.pathView must not be null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException: binding.pathView must not be null
at com.tazik.moviedb.SplashActivity.onCreate(SplashActivity.kt:18)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
这两个库之间有什么冲突?你的建议是什么?