I'm refactoring an app to use androidx. I have struggled to get rid of all the libraries that do not support it.
I thought I had removed all the libraries that use the support libraries but it looks like there is still something that is importing it.
I now get the error:
AGPBI: {"kind":"error","text":"Program type already present:
android.support.v4.os.ResultReceiver$MyResultReceiver","sources":[{}],"tool":"D8"}
java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Error while
merging dex archives:
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/532,
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/0.jar,
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/1.jar,
...
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/530.jar,
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/531.jar
Learn how to resolve the issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present:
android.support.v4.os.ResultReceiver$MyResultReceiver at
sun.reflect.GeneratedConstructorAccessor377.newInstance(Unknown
Source) 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
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) Learn how to resolve the
issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present:
android.support.v4.os.ResultReceiver$MyResultReceiver at
java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431)
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)
Learn how to resolve the issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present:
android.support.v4.os.ResultReceiver$MyResultReceiver at
com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:129)
at
com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:114)
at
com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:101)
at
com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:36)
at
java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
... 4 more at
com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:71)
at
com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:41)
at com.android.tools.r8.D8.run(D8.java:89) at
com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:112)
... 7 more at
com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:83)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:62)
at
com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:62)
... 10 more :app:transformDexArchiveWithDexMergerForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Error while
merging dex archives:
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/532,
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/0.jar,
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/1.jar,
...
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/530.jar,
/Users/name/myproject/app/build/intermediates/transforms/dexBuilder/debug/531.jar
Learn how to resolve the issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present:
android.support.v4.os.ResultReceiver$MyResultReceiver
Running ./gradlew androidDependencies
and I get:
debugCompileClasspath - Dependencies for compilation
+--- io.realm:realm-android-library:5.1.0@aar
+--- io.realm:realm-android-kotlin-extensions:5.1.0@aar
+--- io.realm:realm-annotations:5.1.0@jar
+--- javax.annotation:jsr250-api:1.0@jar
+--- com.google.dagger:dagger-android:2.16@aar
+--- androidx.preference:preference:1.0.0-alpha1@aar
+--- com.google.android.material:material:1.0.0-alpha1@aar
+--- androidx.appcompat:appcompat:1.0.0-alpha1@aar
+--- androidx.cardview:cardview:1.0.0-alpha1@aar
+--- androidx.recyclerview:recyclerview:1.0.0-alpha1@aar
+--- androidx.gridlayout:gridlayout:1.0.0-alpha1@aar
+--- androidx.legacy:legacy-support-v4:1.0.0-alpha1@aar
+--- androidx.vectordrawable:vectordrawable-animated:1.0.0-alpha1@aar
+--- androidx.vectordrawable:vectordrawable:1.0.0-alpha1@aar
+--- androidx.palette:palette:1.0.0-alpha1@aar
+--- com.firebaseui:firebase-ui-auth:3.1.0@aar
+--- com.google.firebase:firebase-auth:15.0.0@aar
+--- com.google.firebase:firebase-config:15.0.2@aar
+--- com.google.firebase:firebase-database:15.0.1@aar
+--- com.jakewharton.rxbinding2:rxbinding:2.0.0@aar
+--- com.jakewharton.rxrelay2:rxrelay:2.0.0@jar
+--- joda-time:joda-time:2.5@jar
+--- com.jakewharton.timber:timber:4.3.1@aar
+--- com.uncopt:android.justified:1.0@jar
+--- androidx.lifecycle:lifecycle-common-java8:2.0.0-alpha1@jar
+--- androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-reactivestreams:2.0.0-alpha1@aar
+--- com.squareup.retrofit2:adapter-rxjava2:2.2.0@jar
+--- com.squareup.retrofit2:converter-moshi:2.2.0@jar
+--- com.squareup.retrofit2:converter-scalars:2.2.0@jar
+--- com.squareup.retrofit2:retrofit:2.2.0@jar
+--- com.squareup.okhttp3:okhttp-urlconnection:3.4.1@jar
+--- com.squareup.okhttp3:logging-interceptor:3.4.1@jar
+--- com.github.franmontiel:PersistentCookieJar:v1.0.1@aar
+--- com.squareup.okhttp3:okhttp:3.6.0@jar
+--- com.squareup.moshi:moshi-kotlin:1.5.0@jar
+--- com.github.MFlisar:RxBus2:0.1@aar
+--- com.jakewharton:butterknife:8.8.1@aar
+--- com.squareup.leakcanary:leakcanary-android:1.5.1@aar
+--- com.crashlytics.sdk.android:crashlytics:2.6.8@aar
+--- com.f2prateek.rx.preferences2:rx-preferences:2.0.0-RC2@aar
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.41@jar
+--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.2.41@jar
+--- com.google.code.findbugs:jsr305:1.3.9@jar
+--- com.getkeepsafe.relinker:relinker:1.2.2@aar
+--- com.google.dagger:dagger:2.16@jar
+--- com.android.support:customtabs:26.1.0@aar
+--- com.android.support:cardview-v7:26.1.0@aar
+--- com.jakewharton:butterknife-annotations:8.8.1@jar
+--- com.android.support:design:26.1.0@aar
+--- com.android.support:appcompat-v7:26.1.0@aar
+--- com.android.support:recyclerview-v7:26.1.0@aar
+--- com.android.support:transition:26.1.0@aar
+--- com.google.firebase:firebase-abt:15.0.1@aar
+--- com.google.firebase:firebase-database-connection:15.0.1@aar
+--- com.google.firebase:firebase-analytics:15.0.2@aar
+--- com.google.firebase:firebase-analytics-impl:15.0.2@aar
+--- com.google.firebase:firebase-iid:15.1.0@aar
+--- com.google.firebase:firebase-common:15.0.1@aar
+--- com.google.android.gms:play-services-phenotype:15.0.1@aar
+--- com.google.firebase:firebase-database-collection:15.0.1@aar
+--- com.google.android.gms:play-services-auth:11.4.2@aar
+--- com.google.android.gms:play-services-ads-identifier:15.0.1@aar
+--- com.google.android.gms:play-services-stats:15.0.1@aar
+--- com.google.firebase:firebase-iid-interop:15.0.0@aar
+--- com.google.android.gms:play-services-auth-api-phone:11.4.2@aar
+--- com.google.android.gms:play-services-auth-base:11.4.2@aar
+--- com.google.android.gms:play-services-flags:15.0.1@aar
+--- com.google.android.gms:play-services-base:15.0.1@aar
+--- com.google.android.gms:play-services-tasks:15.0.1@aar
+--- com.google.android.gms:play-services-basement:15.0.1@aar
+--- com.android.support:support-v4:26.1.0@aar
+--- com.android.support:support-media-compat:26.1.0@aar
+--- com.android.support:support-fragment:26.1.0@aar
+--- com.android.support:support-core-utils:26.1.0@aar
+--- com.android.support:animated-vector-drawable:26.1.0@aar
+--- com.android.support:support-core-ui:26.1.0@aar
+--- com.android.support:support-vector-drawable:26.1.0@aar
+--- com.android.support:support-compat:26.1.0@aar
+--- com.android.support:support-annotations:26.1.0@jar
+--- javax.inject:javax.inject:1@jar
+--- androidx.fragment:fragment:1.0.0-alpha1@aar
+--- androidx.legacy:legacy-support-core-ui:1.0.0-alpha1@aar
+--- androidx.legacy:legacy-support-core-utils:1.0.0-alpha1@aar
+--- androidx.media:media:1.0.0-alpha1@aar
+--- androidx.transition:transition:1.0.0-alpha1@aar
+--- androidx.loader:loader:1.0.0-alpha1@aar
+--- androidx.viewpager:viewpager:1.0.0-alpha1@aar
+--- androidx.coordinatorlayout:coordinatorlayout:1.0.0-alpha1@aar
+--- androidx.drawerlayout:drawerlayout:1.0.0-alpha1@aar
+--- androidx.slidingpanelayout:slidingpanelayout:1.0.0-alpha1@aar
+--- androidx.customview:customview:1.0.0-alpha1@aar
+--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0-alpha1@aar
+--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0-alpha1@aar
+--- androidx.core:core:1.0.0-alpha1@aar
+--- androidx.collection:collection:1.0.0-alpha1@jar
+--- androidx.cursoradapter:cursoradapter:1.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-process:2.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-service:2.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-runtime:2.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-livedata:2.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-livedata-core:2.0.0-alpha1@aar
+--- androidx.lifecycle:lifecycle-common:2.0.0-alpha1@jar
+--- androidx.arch.core:core-runtime:2.0.0-alpha1@aar
+--- androidx.arch.core:core-common:2.0.0-alpha1@jar
+--- androidx.lifecycle:lifecycle-viewmodel:2.0.0-alpha1@aar
+--- androidx.documentfile:documentfile:1.0.0-alpha1@aar
+--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0-alpha1@aar
+--- androidx.print:print:1.0.0-alpha1@aar
+--- androidx.interpolator:interpolator:1.0.0-alpha1@aar
+--- androidx.anno
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…