Android的工作室摇篮错误:多个DEX文件中定义
我试图建立在我的Android Studio项目(我试图从Eclipse的迁移)的时候得到这个错误:
输出:
I'm getting this error when trying to build my project in Android Studio (I'm trying to migrate from Eclipse):
Output:
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
谷歌搜索和检查计算器的最可能的原因是重复的库引用后。照片
我有一些在我的项目,如Facebook SDK,SlidingMenu等,需要Android的支持 - v4.jar库,所以我复制了到我的主要项目的/ libs文件夹中,并随后从所有其他项目库文件夹中删除它。然后我去开放模块设置,并且增加了支持-V4作为一个库的依赖为需要它(比如Facebook SDK)的库。
然后清洁工程 - >运行,但我仍然得到这个倍数DEX文件错误
after googling and checking stackoverflow the most likely cause is duplicate library references.
I have a number of libraries in my project such as Facebook SDK, SlidingMenu, etc. that required android-support-v4.jar, so I copied that into my main project's /libs folder and subsequently removed it from all the other projects libs folder. Then I went to "Open Module Settings" and added the support-v4 as a library dependency for the libraries that needed it (e.g. Facebook SDK).
Then clean project -> run but I'm still getting this multiple dex files error
运行摇篮-q依赖
显示:
+--- project :facebook-android-sdk-3.5.1:facebook
| \--- com.android.support:support-v4:+ -> 19.1.0
+--- project :SlidingMenu:library
| \--- com.android.support:support-v4:+ -> 19.1.0
这样行不行?如果删除该库的依赖,在模块设置,然后我会试图编译我的项目获得更多的错误
Is that okay? If I remove this library dependency in the Module Settings then I will get even more errors while trying to compile my project
在您build.gradle文件中尝试加入你的android块内的下列块。
In your build.gradle file try adding the following block inside your android block.
dexOptions {
preDexLibraries = false
}