android - Lottie动画无法编译-为什么?

标签 android gradle lottie lottie-android

我想在android和lottie中做一个小测试,所以我在android studio中创建了一个新项目,将此行添加到依赖项中:compile 'com.airbnb.android:lottie:2.8.0',但出现此错误:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

这是我由android studio自动生成的gradle代码:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.app.lottie.lottieapp"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    compile 'com.airbnb.android:lottie:2.8.0'
}

最佳答案

解决我问题的方法是将lottie的编译版本更改为:compile 'com.airbnb.android:lottie:2.1.0'

关于android - Lottie动画无法编译-为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54023845/

相关文章:

java - 在Android中加载XML资源

javascript - 如何在android中知道我的webview javascript代码

android - 从最终APK中删除资源文件

ios - lottie 动画在 UIView iOS 中不起作用

什么是上下文?

android - 谷歌应用引擎 : Could not resolve dependencies for configuration: appengineSDK

java - 如何从 Activity 中监听洛蒂动画结束

ios - UIToolbar 中的栏按钮项内的 UIView 不会调用操作

android - android中的不同口味

groovy - 如何在 Groovy/Gradle 中操作存档中的文件?