AndroidX与Android.support RuntimeException

时间:2018-09-28 20:03:06

标签: android android-gradle android-multidex androidx

将步数从android.support更新到androidx之后,我遇到了一些问题

我有这种依赖

 |    +--- com.google.firebase:firebase-core:16.0.3 |    |    |   
    +--- com.google.firebase:firebase-analytics:16.0.3 |    |    |    |    +--- com.google.android.gms:play-services-basement:15.0.1 |    |    |    |    |    \--- com.android.support:support-v4:26.1.0 |    |   
    |    |    |         +--- com.android.support:support-compat:26.1.0
    -> 27.1.1 |    |    |    |    |         |    +--- com.android.support:support-annotations:27.1.1 |    |    |    |    |
    |    \--- android.arch.lifecycle:runtime:1.1.0 |    |    |    |    |
    |         +--- android.arch.lifecycle:common:1.1.0 |    |    |    | 
    |         |         \--- android.arch.core:common:1.1.0 |    |    | 
    |    |         +--- com.android.support:support-media-compat:26.1.0
    |    |    |    |    |         |    +---
    com.android.support:support-annotations:26.1.0 -> 27.1.1 |    |    |
    |    |         |    \--- com.android.support:support-compat:26.1.0
    -> 27.1.1 (*) |    |    |    |    |         +--- com.android.support:support-core-utils:26.1.0 -> 27.1.1 |    |    | 
    |    |         |    +---
    com.android.support:support-annotations:27.1.1 |    |    |    |    |
    |    \--- com.android.support:support-compat:27.1.1 (*) |    |    | 
    |    |         +--- com.android.support:support-core-ui:26.1.0 ->
    27.1.1 |    |    |    |    |         |    +--- com.android.support:support-annotations:27.1.1 |    |    |    |    |
    |    +--- com.android.support:support-compat:27.1.1 (*) |    |    | 
    |    |         |    \---
    com.android.support:support-core-utils:27.1.1 (*) |    |    |    |  
    |         \--- com.android.support:support-fragment:26.1.0 -> 27.1.1
    |    |    |    |    |              +---
    com.android.support:support-compat:27.1.1 (*) |    |    |    |    | 
    +--- com.android.support:support-core-ui:27.1.1 (*) |    |    |    |    |              +--- com.android.support:support-core-utils:27.1.1
    (*) |    |    |    |    |              +---
    com.android.support:support-annotations:27.1.1 |    |    |    |    |
    +--- android.arch.lifecycle:livedata-core:1.1.0 |    |    |    |    |              |    +--- android.arch.lifecycle:common:1.1.0 |    | 
    |    |    |              |    +--- android.arch.core:common:1.1.0 | 
    |    |    |    |              |    \---
    android.arch.core:runtime:1.1.0 |    |    |    |    |              |
    \--- android.arch.core:common:1.1.0 |    |    |    |    |           
    \--- android.arch.lifecycle:viewmodel:1.1.0

我需要从firebasecode中删除com.android.support:support-media-compat:26.1.0,因为

 AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.media.MediaMetadataCompat$RatingKey","sources":[{}],"tool":"D8"}
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 

Error: Program type already present: android.support.v4.media.MediaMetadataCompat$RatingKey

我尝试

api ("com.google.firebase:firebase-core:$rootProject.firebase") {
    exclude group: 'com.android.support'
    exclude module: 'com.android.support'
    exclude module: 'support-v4'
}

和许多其他变体,但不成功

感谢任何想法 //////////////////完全错误

    AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallback","sources":[{}],"tool":"D8"}
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/0, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/1, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/2, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/3, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/4, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/5, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/6, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/7, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/8, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/9, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/10, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/11, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/12, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/13, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/14, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/15, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/16, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/17, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/18, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/19, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/20, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/21, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/22, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/23, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/24, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/25, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/26, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/27, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/28, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/29, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/30, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/31, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/32, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/33, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/34, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/35, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/36, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/37, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/38, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/39, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/40, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/41, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/42, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/43, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/44, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/45, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/46, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/47, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/48, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/49, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/50, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/51, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/52, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/53, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/54, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/55, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/56, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/57, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/58, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/59, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/60, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/61, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/62, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/63, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/64, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/65, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/66, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/67, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/68, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/69, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/70, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/71, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/72, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/73, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/74, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/75, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/76, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/77, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/78, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/79, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/80, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/81, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/82, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/83, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/84, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/85, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/86, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/87, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/88, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/89, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/90, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/91, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/92, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/93, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/94, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/95, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/96, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/97, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/98, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/99, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/100, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/101, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/102, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/103, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/104, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/105, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/106, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/107, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/108, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/109, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/110, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/111, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/112, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/113, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/114, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/115, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/116, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/117, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/118, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/119, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/120, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/121, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/122, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/123, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/124, /home/parad0x/Dokumenty/AndroidProjects/Statistics/CitajCZ/statistikyCZE/build/intermediates/transforms/dexBuilder/debug/125
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallback
    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.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
    at com.android.build.gradle.internal.transforms.DexMergerTransform.transform(DexMergerTransform.java:233)
    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.GeneratedMethodAccessor571.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:124)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
    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.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    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)

当我拥有Firebase内核时,这是我从模块获得的奖励

    apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


android {
    compileSdkVersion rootProject.compileSdkVersion
    defaultConfig {
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        abortOnError false
    }
    lintOptions {
        abortOnError false
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "androidx.appcompat:appcompat:$rootProject.supportXLibraryVersion"
    implementation 'com.google.firebase:firebase-config:16.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    api ("com.google.firebase:firebase-core:$rootProject.firebase") {
        exclude group: 'com.android.support'
        exclude module: 'com.android.support'
        exclude module: 'support-v4'
    }
    implementation project(path: ':parser')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlin_version"
    implementation project(path: ':eventdatamanager')
    api project(path: ':utilities')
}
repositories {
    mavenCentral()
}

这是问题

this is problem but i can't solve it

1 个答案:

答案 0 :(得分:1)

来自the documentation

  

如果一个类在运行时类路径上多次出现,则会出现类似于以下的错误:   Program type already present com.example.MyClass

     

通常由于以下情况之一而发生此错误:

     

二进制依赖项包含一个库,您的应用程序还包含一个库   直接依赖。例如,您的应用声明了直接   对库A和库B的依赖,但是库A已经包括   库B的二进制文件。

  • 要解决此问题,请删除库B作为直接依赖项。您的应用具有本地二进制依赖关系和远程二进制依赖关系 在同一个库中。
  • 要解决此问题,请删除二进制依赖项之一。

无论是什么,它都来自v4个库(可能是com.android.support:support-media-compat:26.1.0):

> Program type already present:
> android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallback
>java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives 

在依赖项结构中,似乎有些依赖项具有旧版本:v 26.1.0

解决方案:

检查是否在Gradle.properties中添加了这两个:

android.useAndroidX = true
android.enableJetifier = false

此外,您可以尝试排除其中包含旧库的依赖项:

例如,可能是android.arch.lifecycle:runtime:1.1.0,其中有com.android.support:support-media-compat:26.1.0

或者如果这样做没有帮助,请删除build目录(其中有中间文件夹)并重建项目,然后它应该可以工作。