我正在尝试将Android Archive(aar
)库用作android项目中的依赖项。该项目被编组并完全编译/打包,最终输出apk
运行良好。正确地在 Intellij IDEA 13.0.2 中打开项目,并创建“gen-external-apklibs
”文件夹。听起来像所有(在aar
库中,例如自定义UI元素等)正确解析但是当我尝试构建和运行项目时,会发生如下错误:
Android Dex: [***] Unable to execute DX
Android Dex: [***] com.android.dex.DexException: Multiple dex files define Lcom/***;
Android Dex: [***] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
Android Dex: [***] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
Android Dex: [***] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
Android Dex: [***] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
Android Dex: [***] at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
Android Dex: [***] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
Android Dex: [***] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
Android Dex: [***] at com.android.dx.command.dexer.Main.run(Main.java:230)
Android Dex: [***] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Android Dex: [***] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Android Dex: [***] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Android Dex: [***] at java.lang.reflect.Method.invoke(Method.java:597)
Android Dex: [***] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161)
Android Dex: [***] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294)
Android Dex: [***] at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)
引用的aar
库本身取决于另一个aar
库
我该如何解决这个问题?
[增订] 包含完整的错误消息。
“[***]
”代替我的项目名称,“com/***
”指的是属于内部 aar 库的类。