【问题标题】:How to fix a Lottie error in Android Studio - 'Error:Execution failed for task' java.lang.RuntimeException [...] unable to merge dex如何修复 Android Studio 中的 Lottie 错误 - 'Error:Execution failed for task' java.lang.RuntimeException [...] 无法合并 dex
【发布时间】:2018-11-13 07:49:16
【问题描述】:

在实现 Lottie 动画时,它告诉我 appcompat 中存在错误。当我取出 Lottie 动画时,它可以完美运行。

错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。 java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.kevinladelfa.life"
    minSdkVersion 23
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    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:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.airbnb.android:lottie:2.5.4'
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.android.support:support-annotations:27.1.1'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-invites:11.8.0'
compile 'com.google.firebase:firebase-ads:11.8.0'
compile 'com.google.firebase:firebase-perf:11.8.0'
}
apply plugin: 'com.google.gms.google-services'

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:4.0.0'
    

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    google()
    jcenter()
    maven{

        url "https://maven.google.com"

    }
}
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

为什么会出现此错误,我该如何解决?

【问题讨论】:

  • 可能是firebase的问题。检查here
  • 检查“构建”选项卡,您可以在那里看到所有错误和警告。
  • 将版本更改为 2.7.0

标签: android android-studio android-gradle-plugin lottie


【解决方案1】:

尝试“实施 'com.airbnb.android:lottie:2.1.2'”,因为这似乎对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    • 2023-03-18
    • 1970-01-01
    • 2018-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多