【问题标题】:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'org.gradle.api.tasks.TaskExecutionException:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败
【发布时间】:2019-02-19 11:47:53
【问题描述】:

我曾多次尝试更新库,但都抛出相同的错误。我认为库有问题。

这是我的 app/build.gradle 文件:

import com.google.gms.googleservices.GoogleServicesPlugin

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {

    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {

        applicationId "com.veblr.videomate"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 16
        versionName "1.0.0.8"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        aaptOptions.cruncherEnabled = true
        aaptOptions.useNewCruncher = false
        vectorDrawables.useSupportLibrary = true
        resConfigs "en"
    }

    buildTypes {

        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            //Other parameters
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            pseudoLocalesEnabled false
            zipAlignEnabled true

        }
        sourceSets {
            main {
                jniLibs.srcDirs = ['libs']
            }
        }
    }
    ext {
        roomVersion = '1.0.0'
        archLifecycleVersion = '1.1.0'
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/rxjava.properties'
        exclude 'META-INF/XXX'
        exclude 'META-INF/license/LICENSE.base64.txt'
        exclude 'META-INF/rxjava.properties'

    }

    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    dexOptions {
        jumboMode true
        preDexLibraries = false
        javaMaxHeapSize "12g" //specify the heap size for the dex process
    }
}
afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = ['--multi-dex']
        } else {
            dx.additionalParameters += '--multi-dex'
        }
        }
    }
 repositories {
    mavenCentral()
    maven { url "https://jitpack.io"
    }
    maven {
        url 'https://maven.google.com/'
        name 'Google'

    }
     maven{  url  "https://adcolony.bintray.com/AdColony"}
     maven {  url 'https://maven.fabric.io/public'
     }
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'com.adcolony:sdk:3.3.0'
    implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'com.google.android.material:material:1.0.0'

    //noinspection GradleCompatible
    implementation 'com.google.ads.mediation:facebook:4.27.0.0'
    implementation 'com.facebook.android:audience-network-sdk:4.27.0'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.danikula:videocache:2.7.0'

    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:retrofit:2.2.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'


    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.firebase:firebase-auth:16.0.5'

    implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'

    // Room components
    implementation 'android.arch.persistence.room:runtime:1.1.1'
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
    androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
    // Lifecycle components
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'junit:junit:4.12'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:1.10.19'
    androidTestImplementation 'com.android.support:support-annotations:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation "android.arch.lifecycle:viewmodel:1.1.1"

    implementation 'android.arch.navigation:navigation-fragment:1.0.0-beta01'
    implementation 'android.arch.navigation:navigation-ui:1.0.0-beta01'
}
apply plugin: 'com.google.gms.google-services'
GoogleServicesPlugin.config.disableVersionCheck = true

如果 firebase 库有任何问题,请建议我应该添加的版本。 欢迎所有建议和答案。

【问题讨论】:

  • 所以在添加 firebase 后你会收到这个错误?
  • 是的。如果还有其他问题可以提出建议。
  • 什么是import com.google.gms.googleservices.GoogleServicesPlugin
  • 这是最后一行的 GoogleServicesPlugin.config.disableVersionCheck = true

标签: android android-studio build.gradle android-multidex


【解决方案1】:

Firebase 具有固定的版本政策。所以请使用相同的版本号更改您的 firebase 依赖项

implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.google.firebase:firebase-crash:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'

这里。 11.6.0 只是一个例子。您可以使用任何更新的依赖项,但版本号相同。

编辑:有关您的问题的详细信息,请执行 ./gradlew tasks 并查看导致该错误的原因

【讨论】:

  • 使用 11.8.0 ,原因:com.android.builder.dexing.DexArchiveBuilderException: 无法处理 C:\User\lenovo\.gradle\caches\transforms-1\files-1.1\play -services-basement-11.8.0.aar\eb7c0640197fd70c2d7dd2cfd71fd4c6\jars\classes.jar 这是错误
  • 引起:com.android.builder.dexing.DexArchiveBuilderException: dexing 时出错。引起:com.android.tools.r8.CompilationFailedException:编译失败引起:com.android.tools.r8.utils.AbortException:错误:接口com.google.android.gms.internal.zzev(classpath class)用作com.google.android.gms.common.internal.zzbb的超类。这些是其他三个错误。
  • @Sushrita 抱歉,这三行没有任何用处
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-07-03
  • 1970-01-01
  • 1970-01-01
  • 2016-10-01
  • 1970-01-01
  • 2022-07-29
  • 1970-01-01
相关资源
最近更新 更多