Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task ':app:transformClassesWithDexBuilderForDebugAndroidTest' java.lang.RuntimeException

I migrated my android project to the AndroidX libraries and I'm having problems running Android tests.

I can compile and run the app with no issues, I can run ./gradlew assembleDebugUnitTest with no issues but it fails to run ./gradlew assembleDebugAndroidTest.

I tried clean/rebuild and invalidating caches and restarting but that didn't work either.

I'm on minSdk=21, compileSdk and targetSdk=28 and buildTools=28.0.3

Here's the full stacktrace, didn't find anything useful in it:

> Task :app:transformClassesWithDexBuilderForDebugAndroidTest FAILED
java.lang.RuntimeException: java.lang.RuntimeException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
        at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
        at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
        at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
        at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.getInitalGraphData(DesugarIncrementalTransformHelper.java:162)
        at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.makeDesugaringGraph(DesugarIncrementalTransformHelper.java:130)
        at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:160)
        at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.getDependenciesPaths(DesugarIncrementalTransformHelper.java:231)
        at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.getD8DesugaringCacheInfo(DexArchiveBuilderTransform.java:461)
        at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:375)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
        at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
        at sun.reflect.GeneratedMethodAccessor1040.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:262)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:246)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:136)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.execute(DefaultTaskPlanExecutor.java:201)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.executeWithTask(DefaultTaskPlanExecutor.java:192)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException
        at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:148)
        at org.objectweb.asm.ClassReader.readModule(ClassReader.java:731)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:632)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
        at com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:144)
        at com.android.builder.desugaring.DesugaringClassAnalyzer.analyzeJar(DesugaringClassAnalyzer.java:92)
        at com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:63)
        at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.lambda$getInitalGraphData$4(DesugarIncrementalTransformHelper.java:150)
        at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException

Here's my build.gradle file:

apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply from: '../dependencies.gradle'

android {
    compileSdkVersion androidCompileSdkVersion
    buildToolsVersion androidBuildToolsVersion
    defaultConfig {
        applicationId "com.domain.app"
        minSdkVersion androidMinSdkVersion
        targetSdkVersion androidTargetSdkVersion
        versionCode appVersionCode
        versionName appVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        abortOnError false
    }
    testOptions {
        unitTests {
            includeAndroidResources true
            returnDefaultValues true
        }
    }
}

dependencies {
    final GMS_CORE = "12.0.0"
    final INSTALL_REFERER = "1.0"
    final HYPERION = "0.9.22"

    implementation project(':analytics')
    implementation project(':analytics-android')
    implementation project(':answer-skill-milestones')
    implementation project(":api")
    implementation project(":billing")
    implementation project(":models")
    implementation project(":rxplaybilling")
    implementation project(':utilities')
    implementation project(':utilities-android')
    implementation project(":data")
    implementation project(':local-storage')
    implementation project(":interactors")
    implementation project(':interactors-android')
    implementation project(":milestones")
    implementation project(":navigation")
    implementation project(':premium-process')
    implementation project(":dynamic-variables")
    implementation project(':facebook')
    implementation project(':growing-up')

    implementation libraries.androidKtx
    implementation libraries.androidXFragment
    implementation libraries.ankoCommons
    implementation libraries.ankoDesign
    implementation libraries.archCore
    implementation libraries.archLifecycleExt
    kapt libraries.archLifecycleCompiler
    implementation libraries.billingClient
    implementation libraries.butterknife
    kapt libraries.butterknifeCompiler
    implementation libraries.calligraphy
    implementation libraries.circleImageView
    implementation(libraries.crashlytics) { transitive = true }
    implementation "com.google.guava:guava:26.0-android"
    implementation libraries.kochava
    implementation libraries.rxJava2
    implementation libraries.rxKotlin
    implementation libraries.timber
    implementation libraries.kotlin
    implementation libraries.dagger2
    implementation libraries.dagger2Android
    implementation libraries.dagger2AndroidSupport
    kapt libraries.dagger2AndroidProcessor
    kapt libraries.dagger2Compiler
    implementation libraries.exoplayer
    implementation libraries.expandableTextView
    implementation libraries.facebook
    implementation libraries.firebaseCore
    implementation libraries.glide
    implementation libraries.gson
    implementation libraries.imageCropper
    implementation libraries.leanplum
    implementation libraries.leanplumFcm
    implementation libraries.firebaseMsg
    implementation libraries.mixpanel
    implementation libraries.okhttp
    implementation libraries.okhttpLoggingInterceptor
    implementation libraries.support
    implementation libraries.supportAnimatedVectorDrawable
    implementation libraries.supportAnnotations
    implementation libraries.supportAppCompat
    implementation libraries.supportCardView
    implementation libraries.supportConstraintLayout
    implementation libraries.supportCustomTabs
    implementation libraries.supportDesign
    implementation libraries.supportRecyclerView
    implementation libraries.recyclerAnimators
    implementation libraries.retrofit2
    implementation libraries.retrofit2RxJavaAdapter
    implementation libraries.retrofit2GsonConverter
    implementation libraries.rxAndroid
    implementation libraries.rxBinding
    implementation libraries.rxBindingKotlin
    implementation libraries.rxRelay
    implementation "org.checkerframework:checker-compat-qual:2.5.3"
    implementation "com.google.errorprone:error_prone_annotations:2.3.1"

    testImplementation libraries.androidXFragmentTesting
    testImplementation libraries.androidXTestCore
    testImplementation libraries.androidXTestEspressoCore
    testImplementation libraries.androidXTestEspressoIntents
    testImplementation libraries.androidXTestExtJUnit
    testImplementation libraries.androidXTestExtTruth
    testImplementation libraries.androidXTestRules
    testImplementation libraries.androidXTestRunner
    testImplementation libraries.junit
    testImplementation libraries.mockito
    testImplementation libraries.mockitoKotlin
    testImplementation libraries.robolectric
    testImplementation libraries.robolectricShadowsSupportv4

    androidTestImplementation libraries.androidXFragmentTesting
    androidTestImplementation libraries.androidXTestCore
    androidTestImplementation libraries.androidXTestEspressoCore
    androidTestImplementation libraries.androidXTestEspressoIntents
    androidTestImplementation libraries.androidXTestExtJUnit
    androidTestImplementation libraries.androidXTestExtTruth
    androidTestImplementation libraries.androidXTestRules
    androidTestImplementation libraries.androidXTestRunner
    androidTestImplementation libraries.mockito
    androidTestImplementation libraries.mockitoKotlin
    androidTestImplementation libraries.robolectric
    androidTestImplementation libraries.robolectricShadowsSupportv4
    androidTestImplementation "org.checkerframework:checker-compat-qual:2.5.3"

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.google.android.gms:play-services-base:$GMS_CORE"
    implementation "com.google.android.gms:play-services-gcm:$GMS_CORE"
    implementation "com.google.android.gms:play-services-location:$GMS_CORE"
    implementation "com.google.android.gms:play-services-ads:$GMS_CORE"
    implementation "com.android.installreferrer:installreferrer:$INSTALL_REFERER"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-core:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-attr:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-measurement:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-disk:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-recorder:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-phoenix:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-shared-preferences:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-geiger-counter:$HYPERION"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-timber:$HYPERION"
}

And the gradle file where all the dependencies and gradle constants are defined:

rootProject.ext {
    androidBuildToolsVersion = '28.0.3'
    androidCompileSdkVersion = 28
    androidMinSdkVersion = 21
    androidTargetSdkVersion = 28

    appVersionCode = 171
    appVersionName = "1.6.0-rc4"

    kotlinVersion = "1.2.71"

    // ORDERED ALPHABETICALLY.
    libraries = [
        androidKtx: "androidx.core:core-ktx:1.0.0-alpha1",
        androidXFragment: "androidx.fragment:fragment:1.1.0-alpha01",
        androidXFragmentTesting: "androidx.fragment:fragment-testing:1.1.0-alpha01",
        androidXTestCore: "androidx.test:core:1.0.0-beta01",
        androidXTestEspressoCore: "androidx.test.espresso:espresso-core:3.1.0",
        androidXTestEspressoIntents: "androidx.test.espresso:espresso-intents:3.1.0",
        androidXTestExtJUnit: "androidx.test.ext:junit:1.0.0",
        androidXTestExtTruth: "androidx.test.ext:truth:1.0.0",
        androidXTestRules: "androidx.test:rules:1.1.0",
        androidXTestRunner: "androidx.test:runner:1.1.0",
        ankoCommons: "org.jetbrains.anko:anko-commons:0.10.4",
        ankoDesign: "org.jetbrains.anko:anko-design:0.10.4",
        archCore: "androidx.arch.core:core-runtime:2.0.0-rc01",
        archLifecycleExt: "androidx.lifecycle:lifecycle-extensions:2.0.0-rc01",
        archLifecycleCompiler: "androidx.lifecycle:lifecycle-compiler:2.0.0-rc01",
        billingClient: "com.android.billingclient:billing:1.0",
        butterknife: "com.jakewharton:butterknife:9.0.0-SNAPSHOT",
        butterknifeCompiler: "com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT",
        calligraphy: "com.github.kibotu:Calligraphy:v4.0.1",
        circleImageView: "de.hdodenhof:circleimageview:2.1.0",
        crashlytics: "com.crashlytics.sdk.android:crashlytics:2.7.1@aar",
        dagger2: "com.google.dagger:dagger:2.16",
        dagger2Android: 'com.google.dagger:dagger-android:2.16',
        dagger2AndroidSupport: 'com.google.dagger:dagger-android-support:2.16',
        dagger2AndroidProcessor: 'com.google.dagger:dagger-android-processor:2.16',
        dagger2Compiler: "com.google.dagger:dagger-compiler:2.16",
        exoplayer: "com.google.android.exoplayer:exoplayer:2.8.2",
        expandableTextView: "at.blogc:expandabletextview:1.0.5",
        facebook: "com.facebook.android:facebook-android-sdk:4.36.1",
        firebaseCore: "com.google.firebase:firebase-core:12.0.0",
        firebaseMsg: "com.google.firebase:firebase-messaging:12.0.0",
        glide: "com.github.bumptech.glide:glide:4.7.1",
        gson: "com.google.code.gson:gson:2.7",
        imageCropper: "com.theartofdev.edmodo:android-image-cropper:2.6.0",
        junit: "junit:junit:4.12",
        kochava: "com.kochava.base:tracker:3.3.1",
        kotlin: "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion",
        ktlint: "com.github.shyiko:ktlint:0.29.0",
        leanplum: "com.leanplum:leanplum-core:4.2.0",
        leanplumFcm: "com.leanplum:leanplum-fcm:4.2.0",
        mixpanel: "com.mixpanel.android:mixpanel-android:5.+",
        mockito: "org.mockito:mockito-core:2.7.1",
        mockitoKotlin: "com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-RC1",
        okhttp: "com.squareup.okhttp3:okhttp:3.4.1",
        okhttpLoggingInterceptor: "com.squareup.okhttp3:logging-interceptor:3.4.1",
        recyclerAnimators: "jp.wasabeef:recyclerview-animators:2.2.5",
        retrofit2: "com.squareup.retrofit2:retrofit:2.3.0",
        retrofit2RxJavaAdapter: "com.squareup.retrofit2:adapter-rxjava2:2.3.0",
        retrofit2GsonConverter: "com.squareup.retrofit2:converter-gson:2.3.0",
        robolectric: "org.robolectric:robolectric:4.0.2",
        robolectricShadowsSupportv4: "org.robolectric:shadows-support-v4:3.0",
        rxAndroid: "io.reactivex.rxjava2:rxandroid:2.0.1",
        rxBinding: "com.jakewharton.rxbinding2:rxbinding:2.0.0",
        rxBindingKotlin: "com.jakewharton.rxbinding2:rxbinding-kotlin:2.0.0",
        rxKotlin : "io.reactivex.rxjava2:rxkotlin:2.1.0",
        rxJava2 : "io.reactivex.rxjava2:rxjava:2.1.0",
        rxRelay: "com.jakewharton.rxrelay2:rxrelay:2.0.0",
        support: "androidx.legacy:legacy-support-v4:1.0.0",
        supportAnimatedVectorDrawable: "androidx.vectordrawable:vectordrawable-animated:1.0.0",
        supportAnnotations: "androidx.annotation:annotation:1.0.0",
        supportAppCompat: "androidx.appcompat:appcompat:1.0.2",
        supportCardView: "androidx.cardview:cardview:1.0.0",
        supportConstraintLayout: "androidx.constraintlayout:constraintlayout:1.1.2",
        supportCustomTabs: "androidx.browser:browser:1.0.0",
        supportDesign: "com.google.android.material:material:1.0.0-rc01",
        supportRecyclerView: "androidx.recyclerview:recyclerview:1.0.0",
        timber: "com.jakewharton.timber:timber:4.7.1",
    ]
}
like image 560
Jorge Gil Avatar asked Nov 25 '18 22:11

Jorge Gil


1 Answers

delete below denpendencies then try it again.

androidTestImplementation libraries.mockito
androidTestImplementation libraries.mockitoKotlin
like image 140
weilin Avatar answered Oct 14 '22 21:10

weilin