简体   繁体   English

意外的顶级异常:com.android.dex.DexException:多个dex文件定义

[英]UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define

When I add the configurations for google analytics to my Android project and build the project I get the following error: 当我将谷歌分析的配置添加到我的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.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.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$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.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$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.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? 这是什么意思,我该如何防止这个错误?

A little late to the game here but this is most likely a 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 need to 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. 除非你绝对需要在你的build.gradle中启用multiDex,否则要这样做,这只是踩过你应用中的底层问题而不是找到它的根源。 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. 您也不必要地增加了apk的大小,并且当您的dex文件中存在冲突方法时,可能会发生意外崩溃。

Things to look out for: 需要注意的事项:

Check all your dependencies in your build.gradle file. 检查build.gradle文件中的所有依赖项。 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. 例如,如果您包含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 AWAY from 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留在你的build.gradle compile 'com.google.android.gms:play-services:8.3.0' ,而是只使用你所需要的!

Google has a comprehensive list of the libraries for selectively compiling here Google有一个完整的库列表,可以在这里有选择地进行编译

With all that said you probably only need to include this one line in gradle for your Google Analytics: 尽管如此,您可能只需要在Gradle中为Google Analytics包含这一行:

  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工作室中使用终端)并运行来查看依赖关系树:

./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. 从Android Studio 2.2开始,无论您是否需要在应用程序中使用multi-dex,都不再需要反复试验。 Use the Apk Analyzer to see if its really needed! 使用Apk Analyzer查看它是否真的需要!

Explication: Building Apps with Over 65K Methods 说明: 使用超过65K方法构建应用程序

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. Android应用程序(APK)文件包含Dalvik可执行文件(DEX)文件形式的可执行字节码文件,其中包含用于运行应用程序的编译代码。 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. Dalvik可执行规范将单个DEX文件中可引用方法总数限制为65,536 ,包括Android框架方法,库方法和您自己的代码中的方法。 Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration. 超过此限制要求您配置应用程序构建过程以生成多个DEX文件,称为多索引配置。

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. 就好像你有两个模块(限制:2 x 65K)但是压缩成一个模块。 This entails a cost (time) in the build process. 这需要构建过程中的成本(时间)。

Solution: 解:

  1. 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. 例如,如果您使用地图播放服务(com.google.android.gms:play-services:8.1.0),则可以更改为(编译'com.google.android.gms:play-services-maps:8.1。 0')消除不必要的库依赖。 Then Sync Gradle in AndroidStudio and check if it run. 然后在AndroidStudio中同步Gradle并检查它是否运行。 If no run go to point 2. 如果没有运行转到第2点。
  2. Add this on build.gradle (app module). build.gradle (app模块)上添加它。
 android { ... defaultConfig { ... multiDexEnabled true } } 

对我而言,它与simplexml转换器有关,用于改造2.它由以下固定:

compile ("com.squareup.retrofit2:converter-simplexml:2.0.0-beta4"){ exclude module: 'stax' exclude module: 'stax-api' exclude module: 'xpp3'}

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. Android 5.0及更高版本使用名为ART的运行时,它本身支持从应用程序APK文件加载多个dex文件。 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. ART在应用程序安装时执行预编译,扫描类(.. N).dex文件并将它们编译成单个.oat文件以供Android设备执行。 For more information on the Android 5.0 runtime, see Introducing ART. 有关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. Android 5.0之前的平台版本使用Dalvik运行时来执行应用程序代码。 By default, Dalvik limits apps to a single classes.dex bytecode file per APK. 默认情况下,Dalvik将应用程序限制为每个APK的单个classes.dex字节码文件。 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. 为了解决这个限制,您可以使用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. 在清单中,将Multidex支持库中的MultiDexApplication类添加到application元素中。

<?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)来启用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 : 最后,您需要通过添加multiDexEnabled true来更新build.gradle文件,如下所示:

defaultConfig {  
        applicationId '{Project Name}'  
        minSdkVersion 15  
        targetSdkVersion 23  
        versionCode 1  
        versionName "1.0"  
        multiDexEnabled true  
    }  

I hope it will help you out. 我希望它会帮助你。

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. 一旦我删除了第二个条目,它工作正常。

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. 在build.gradle中,一个依赖项可能已经包含在其他依赖项中,从而产生冲突。 I removed necessary dependencies and solved my problem. 我删除了必要的依赖项并解决了我的问题。

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. 我做了什么来解决这个问题,从这里删除了gradle更改( https://developers.google.com/analytics/devguides/collection/android/v4/ )然后在Android Studio中进入'文件/项目结构'然后点击进入分析,如果选中此框,则取消选中它,让gradle sync然后再次选中该复选框,然后单击按钮进行登录。完成所有这些以使分析跟踪器正常工作后,您只需将实际跟踪器ID复制到mTracker = analytics.newTracker(<here>)查看此页面以获取帮助。 https://developers.google.com/android/reference/com/google/android/gms/analytics/GoogleAnalytics https://developers.google.com/android/reference/com/google/android/gms/analytics/GoogleAnalytics

Include specific dependencies in the build file. 在构建文件中包含特定的依赖项。

If you want to add maps into your app then include compile ' com.google.android.gms:play-services-location:9.2.1 ' 如果您想将地图添加到您的应用中,请包含编译' com.google.android.gms:play-services-location:9.2.1 '


instead of compile ' com.google.android.gms:play-services:9.2.1 ' 而不是编译' com.google.android.gms:play-services:9.2.1 '

我认为你使用谷歌分析sdk V3使用V4而我在使用谷歌分析的sdk V3时也遇到了同样的问题https://developers.google.com/analytics/devguides/collection/android/v4/看到这个链接更多信息。

This could happen if you updated Android Studio to the latest version 1.4. 如果您将Android Studio更新到最新版本1.4,则可能会发生这种情况。 Did you update the support libraries to the latest versions? 您是否将支持库更新到最新版本? Your compileSdkVersion should be 23. 你的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'

}

I actually found that having too many Android Studio modules was contributing to having this error without multidex enabled. 我实际上发现有太多Android Studio模块导致在没有启用multidex的情况下出现此错误。 If you are trying to avoid enabling multidex the limit seemed to be around 26 modules. 如果您试图避免启用multidex,那么限制似乎大约是26个模块。 This was with Android Studio 1.5.1 这是Android Studio 1.5.1

The same problem but when using react-native-svg. 同样的问题,但使用react-native-svg时。 This helped me: 这对我有所帮助:

cd android
./gradlew clean

Source 资源

From Android developer website: 来自Android开发者网站:

Android 5.0 (API level 21) and higher uses a runtime called ART which naively supports loading multiple DEX files from APK files. Android 5.0(API级别21)及更高版本使用名为ART的运行时,它天真地支持从APK文件加载多个DEX文件。

I have set the min SDK to 21 and it solved the issue for me (of course you need to check your specific case if setting min-SDK to 21 or greater is fine with you) 我已将min SDK设置为21并且它为我解决了问题(当然,如果将min-SDK设置为21或更高版本,则需要检查您的具体情况)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 意外的顶级异常:com.android.dex.DexException:多个dex文件定义 - UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define 意外的顶级异常:com.android.dex.DexException - UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException 将字节码转换为dex:原因:com.android.dex.DexException:定义了多个dex文件 - converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / location / places / PlaceReport; - com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/location/places/PlaceReport; 错误:com.android.dex.DexException:多个dex文件定义了Ledu / umd / cs / findbugs / annotations / NonNull; - Error:com.android.dex.DexException: Multiple dex files define Ledu/umd/cs/findbugs/annotations/NonNull; com.android.dex.DexException:多个dex文件定义了Lcom / facebook / internal / Utility $ GraphMeRequestWithCacheCallback; - com.android.dex.DexException: Multiple dex files define Lcom/facebook/internal/Utility$GraphMeRequestWithCacheCallback; com.android.dex.DexException:多个dex文件定义Lorg / hamcrest / Description; - com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description; 将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / RNFetchBlob / RNFetchBlobConst; - Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/RNFetchBlob/RNFetchBlobConst; 未知源文件:com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / internal / zzpq; - Unknown source file : com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzpq; 错误:将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / common / api / zza; - Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zza;
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM