将Lottie Library添加到Android Studio Project中可以使我做到这一点:“无法解决依赖关系”

时间:2019-03-15 12:52:27

标签: android gradle android-gradle

我正在尝试使用此行将Lottie库添加到我的Android项目中:

implementation 'com.airbnb.android:lottie:2.5.0'

&同步后显示此错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.airbnb.android:lottie:2.5.0.

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.airbnb.android:lottie:2.5.0.

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.airbnb.android:lottie:2.5.0.

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.airbnb.android:lottie:2.5.0.

我也尝试添加其他Lottie版本,但仍然显示相同的错误。我正在使用Android Studio 3.2,而Target SDK是28。 请帮我解决这个问题。

3 个答案:

答案 0 :(得分:0)

似乎不存在普通的2.5版本(根据其Github repo

使用2.7代替:

implementation 'com.airbnb.android:lottie:2.7.0'

答案 1 :(得分:0)

仅当您缺少与特定实现依赖性相关的文件或组件时,才会发生此错误(无法解决错误) 确保在res文件夹中也添加json文件... app-> res,然后右键单击并新建---> folder-> assets文件夹并将其粘贴。.

答案 2 :(得分:0)

使用3.0.0,您会很高兴。 编码愉快

dependencies {
  implementation 'com.airbnb.android:lottie:3.0.0'
}