исключение больше не нужно.

енные проекты, которые приносят свои собственныеxmlpullparser В Android Studio всегда требовалась особая осторожность, поскольку в Android появился собственный xmlpullparser.

Например. популярный картограф XMLXStream требуется это исключить(1) (2) :

compile('com.thoughtworks.xstream:xstream:1.4.7') {
    exclude group: 'xmlpull', module: 'xmlpull' //exclude xmlpull to avoid `Multiple dex files define`-error
}

Где-нибудь еще Я также видел:

compile('com.thoughtworks.xstream:xstream:1.4.7') {
      exclude group: 'xmlpull'
     exclude group: 'XmlPullParser'
  }

Новости по этому вопросу: Исключение сработало на плагине Android версии 2.3.3, а на плагине Android версии 3.0.0 я снова получаю ошибки! (Вы можете увидеть версию плагина Android под Файл> Структура проекта> Проект)

Кто-нибудь уже понял, как изменить файл Gradle, чтобы запустить xstreamПлагин Android версии 3.0.0?

Я просто подозреваю, что XStream вызывает эту ошибку.

16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
16:40:26.671 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionR,eporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
16:40:26.672 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:72)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: com.android.dex.DexException: Multiple dex files define Lorg/xmlpull/mxp1/MXParser;
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
16:40:26.673 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 1 more
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
16:40:26.674 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 37s

Ответы на вопрос(1)

Решение Вопроса

я все еще озадачен, почему это зависело от версии плагина Gradle.

Я используюLogback-андроид это как-то зависит от xpp3, как вы можете видеть на графике зависимостей:

    +--- com.github.tony19:logback-android-classic:1.1.1-6
|    |    +--- com.github.tony19:logback-android-core:1.1.1-6
|    |    \--- com.github.tony19:apktool-lib:1.4.4-3
|    |         \--- com.google.android:android:2.1_r1
|    |              +--- commons-logging:commons-logging:1.1.1
|    |              +--- org.apache.httpcomponents:httpclient:4.0.1
|    |              |    +--- org.apache.httpcomponents:httpcore:4.0.1
|    |              |    +--- commons-logging:commons-logging:1.1.1
|    |              |    \--- commons-codec:commons-codec:1.3
|    |              +--- org.khronos:opengl-api:gl1.1-android-2.1_r1
|    |              +--- xerces:xmlParserAPIs:2.6.2
|    |              \--- xpp3:xpp3:1.1.4c

Надо сказать, что я объявил logback-android в модуле утилит, который я затем включил в свое приложение, используяimplementation project(:'myUtilsModule')

Теперь я исключил группуxpp3 с его модулемxpp3, Имена групп и модулейxmlpull не сработает.

// https://mvnrepository.com/artifact/com.github.tony19/logback-android-classic
implementation('com.github.tony19:logback-android-classic:1.1.1-6') {
    exclude group: 'xpp3', module: 'xpp3'  //in order to avoid "Multiple dex files define Lorg/xmlpull/v1/XmlPullParser;"
    //exclude group: 'xmlpull', module: 'xmlpull' //This works usually on other libs to exclude xmlpull, but not on that one
}

Я усвоил сложный способ чтения графа зависимостей и исключения элементов из графа;)

БегатьКак показать дерево зависимостей в Android Studio?Каждая строка в графе зависимостей имеет формат<group>:<module>:<version>который сопоставляется с аргументами исключенияexclude group: '<group>', module: '<module>' или простоexclude module: '<module>'

Обновить: С участиемLogback-андроид-1.1.1-7 + исключение больше не нужно.

Ваш ответ на вопрос