Java 意外的顶级异常:com.android.dex.DexException:多个 dex 文件定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32798816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define
提问by confile
When I add the configurations for google analyticsto my Android project and build the project I get the following error:
当我将google 分析的配置添加到我的 Android 项目并构建项目时,我收到以下错误:
:app:transformClassesWithDexForDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Ljavax/inject/Inject;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access0(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.internal.UncheckedException: com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:45)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:78)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 57 more
Caused by: com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:411)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:112)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
... 63 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42)
at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1325)
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:396)
... 65 more
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40)
... 67 more
What does this mean and how can I prevent this error?
这是什么意思,我该如何防止这个错误?
采纳答案by kandroidj
A little late to the game here but this is most likelya problem with the dependencies you have listed in your build.gradle
file for you app.
这里的游戏有点晚了,但这很可能是您在build.gradle
文件中为您的应用程序列出的依赖项的问题。
After lots of testing i successfully chased down my problem and believe it could be of help to others.
经过大量测试后,我成功地解决了我的问题,并相信它可以对其他人有所帮助。
Things I do not recommend:
我不推荐的事情:
Unless you have an absolute needto enable multiDex in your build.gradle DO NOT DO IT, this is just stepping over the underlying problem in your app and not getting to the root of it. You are also unnecessarily increasing the size of your apk, and there could be unexpected crashes when there is a conflicting method in your dex file.
除非您绝对需要在 build.gradle 中启用 multiDex请勿这样做,否则这只是跳过了应用程序中的潜在问题,而没有找到它的根源。您还不必要地增加了 apk 的大小,并且当 dex 文件中存在冲突的方法时可能会出现意外崩溃。
Things to look out for:
需要注意的事项:
Check all your dependencies in your build.gradle file. Are you referencing a dependency that also includes a dependency you have already included? For example, if your including appcompat-v7 there is no need to include appcompat-v4 since v7 includes all features from v4.
检查 build.gradle 文件中的所有依赖项。您是否引用了一个还包含您已经包含的依赖项的依赖项?例如,如果您包含 appcompat-v7,则无需包含 appcompat-v4,因为 v7 包含 v4 的所有功能。
WHAT I ACTUALLY FOUND (MY ISSUE causing my app to exceed method limit in my dex file) ----> GOOGLE PLAY SERVICES
我实际发现的内容(我的问题导致我的应用程序超出了我的 dex 文件中的方法限制)----> GOOGLE PLAY SERVICES
If you do not need all the google play services library dependencies STAY AWAYfrom this line in your build.gradle
compile 'com.google.android.gms:play-services:8.3.0'
and instead just use what you need!!
如果你并不需要所有的谷歌Play服务库依赖AWAY STAY从这一行你的build.gradle
compile 'com.google.android.gms:play-services:8.3.0'
,而是只使用你所需要的!
Google has a comprehensive list of the libraries for selectively compiling here
谷歌有一个完整的库列表,可以在这里有选择地编译
With all that said you probably only need to include this one line in gradle for your Google Analytics:
综上所述,您可能只需要在 Google Analytics 的 gradle 中包含这一行:
dependencies{
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
EDIT
编辑
Also, you can view the dependency tree by going to the root of your project (or using terminal in Android studio) and running:
此外,您可以通过转到项目的根目录(或在 Android Studio 中使用终端)并运行来查看依赖关系树:
./gradlew app:dependencies
Good Luck and happy coding!
祝你好运,快乐编码!
Update
更新
Now as of Android Studio 2.2 you no longer need to trial and error whether you need to use multi-dex in your application. Use the Apk Analyzerto see if its really needed!
现在,从 Android Studio 2.2 开始,您不再需要反复试验是否需要在应用程序中使用 multi-dex。使用Apk Analyzer看看它是否真的需要!
回答by Satyavrat
i think you are using google analytic sdk V3 use V4 instead i have also facing the same issue while using sdk V3 of google analytic https://developers.google.com/analytics/devguides/collection/android/v4/see this link for more information.
我认为您正在使用 google analytic sdk V3 使用 V4 而我在使用 google analytic https://developers.google.com/analytics/devguides/collection/android/v4/ 的sdk V3 时也面临同样的问题,请参阅此链接更多信息。
回答by Ryan Johnston
What i did to fix this is removed the gradle changes from here (https://developers.google.com/analytics/devguides/collection/android/v4/) then in Android Studio went into 'file/Project Structure' then click into analytics and if the box is checked uncheck it, let gradle sync then check the box again and click the button to sign in. After all this to get your analytics tracker working you just have to copy your actual tracker id into mTracker = analytics.newTracker(<here>)
look at this page for help. https://developers.google.com/android/reference/com/google/android/gms/analytics/GoogleAnalytics
我为解决此问题所做的是从此处删除了 gradle 更改(https://developers.google.com/analytics/devguides/collection/android/v4/),然后在 Android Studio 中进入“文件/项目结构”,然后单击进入分析,如果选中该框,取消选中它,让 gradle 同步,然后再次选中该框并单击按钮登录。 毕竟,要让您的分析跟踪器工作,您只需将实际跟踪器 ID 复制mTracker = analytics.newTracker(<here>)
到此页面即可查看帮助。https://developers.google.com/android/reference/com/google/android/gms/analytics/GoogleAnalytics
回答by SergioLucas
Explication:Building Apps with Over 65K Methods
Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.
Android 应用程序 (APK) 文件包含 Dalvik 可执行文件 (DEX) 文件形式的可执行字节码文件,其中包含用于运行您的应用程序的编译代码。Dalvik Executable 规范将单个 DEX 文件中可以引用的方法总数限制为 65,536,包括 Android 框架方法、库方法和您自己代码中的方法。要突破这一限制,您需要将应用程序构建过程配置为生成多个 DEX 文件,称为 multidex 配置。
Note:This allows you to refer to all methods of the app. It is as if you have two modules (limit: 2 x 65K) but compacted into one. This entails a cost (time) in the build process.
注意:这允许您参考应用程序的所有方法。就好像您有两个模块(限制:2 x 65K)但被压缩为一个。这需要构建过程中的成本(时间)。
Solution:
解决方案:
- You should try to format your code with libraries to remove excess classes and also not exceed the limit methods. For example if you use maps play-services ( com.google.android.gms: play-services: 8.1.0), you can change to (compile 'com.google.android.gms:play-services-maps:8.1.0') to eliminate unnecessary library dependencies. Then Sync Gradle in AndroidStudio and check if it run. If no run go to point 2.
- Add this on build.gradle(app module).
- 您应该尝试使用库格式化您的代码,以删除多余的类并且不超过限制方法。例如,如果您使用地图播放服务 (com.google.android.gms: play-services: 8.1.0),则可以更改为 (compile 'com.google.android.gms:play-services-maps:8.1. 0') 以消除不必要的库依赖项。然后在 AndroidStudio 中同步 Gradle 并检查它是否运行。如果没有运行,请转到第 2 点。
- 将此添加到build.gradle(应用程序模块)。
android { ... defaultConfig { ... multiDexEnabled true } }
android { ... defaultConfig { ... multiDexEnabled true } }
回答by Bhavesh Patadiya
Multidex support for Android 5.0 and higher
对 Android 5.0 及更高版本的 Multidex 支持
Android 5.0 and higher uses a runtime called ART which natively supports loading multiple dex files from application APK files. ART performs pre-compilation at application install time which scans for classes(..N).dex files and compiles them into a single .oat file for execution by the Android device. For more information on the Android 5.0 runtime, see Introducing ART.
Android 5.0 及更高版本使用称为 ART 的运行时,该运行时本机支持从应用程序 APK 文件加载多个 dex 文件。ART 在应用程序安装时执行预编译,扫描类 (..N).dex 文件并将它们编译成单个 .oat 文件以供 Android 设备执行。有关 Android 5.0 运行时的更多信息,请参阅 ART 简介。
That means your app would working fine on API level 21 or above.
这意味着您的应用程序可以在 API 级别 21 或更高级别上正常运行。
Multidex support prior to Android 5.0
Android 5.0 之前的 Multidex 支持
Versions of the platform prior to Android 5.0 use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around this limitation, you can use the multidex support library, which becomes part of the primary DEX file of your app and then manages access to the additional DEX files and the code they contain.
Android 5.0 之前的平台版本使用 Dalvik 运行时来执行应用程序代码。默认情况下,Dalvik 将应用程序限制为每个 APK 的单个 classes.dex 字节码文件。为了解决这个限制,您可以使用 multidex 支持库,它成为您应用的主要 DEX 文件的一部分,然后管理对其他 DEX 文件及其包含的代码的访问。
So, Firstly making sure you have imported correct dependency, which It seems you did it.
因此,首先确保您导入了正确的依赖项,这似乎是您做到的。
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
In your manifest add the MultiDexApplication
class from the multidex support library to the application element.
在您的清单中MultiDexApplication
,将 multidex 支持库中的类添加到应用程序元素。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
Alternative to that, If your app extends the Application
class, you can override the attachBaseContext()
method and call MultiDex.install(this)
to enable multidex
.
或者,如果您的应用扩展了Application
该类,您可以覆盖该attachBaseContext()
方法并调用MultiDex.install(this)
enable multidex
。
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Finally, you will need to update your build.gradle file as below by adding multiDexEnabled true
:
最后,您需要通过添加以下内容来更新您的 build.gradle 文件multiDexEnabled true
:
defaultConfig {
applicationId '{Project Name}'
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
I hope it will help you out.
我希望它能帮助你。
回答by user2759839
This could happen if you updated Android Studio to the latest version 1.4. Did you update the support libraries to the latest versions? Your compileSdkVersion
should be 23.
如果您将 Android Studio 更新到最新版本 1.4,则可能会发生这种情况。您是否将支持库更新到最新版本?你compileSdkVersion
应该是23岁。
apply plugin: 'com.android.application'
android {
compileSdkVersion 23 //update this to 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "your.package.name"
minSdkVersion 16
targetSdkVersion 21
multiDexEnabled true //enable this
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
// update these to 23 if you have them and add the multidex
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.1'
}
回答by Android-Christensen
I actually found that having too many Android Studio modules was contributing to having this error without multidex enabled. If you are trying to avoid enabling multidex the limit seemed to be around 26 modules. This was with Android Studio 1.5.1
我实际上发现有太多的 Android Studio 模块会导致在没有启用 multidex 的情况下出现这个错误。如果您试图避免启用 multidex,则限制似乎在 26 个模块左右。这是 Android Studio 1.5.1
回答by techtinkerer
in my case, I had this twice in the build.grade file
就我而言,我在 build.grade 文件中有两次
compile 'com.google.android.gms:play-services-auth:8.4.0'
Once I removed the 2nd entry, it worked fine.
一旦我删除了第二个条目,它就可以正常工作。
回答by Denis Nek
For me it was related to simplexml converter for retrofit 2. And it fixed by:
对我来说,它与用于改造 2 的 simplexml 转换器有关。它通过以下方式修复:
compile ("com.squareup.retrofit2:converter-simplexml:2.0.0-beta4"){
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'}
compile ("com.squareup.retrofit2:converter-simplexml:2.0.0-beta4"){
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'}
回答by JohannaX
Exactly the same problem as I encountered!
和我遇到的问题一模一样!
I found out that it was due to duplicate dependencies. In build.gradle, one dependency may be already included in others, thus generate conflicts. I removed necessary dependencies and solved my problem.
我发现这是由于重复的依赖关系。在 build.gradle 中,一个依赖可能已经包含在其他依赖中,从而产生冲突。我删除了必要的依赖项并解决了我的问题。