Java Android Socialize SDK:无法执行 dex:多个 dex 文件定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20087081/
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
Android Socialize SDK: Unable to execute dex: Multiple dex files define
提问by emen
I'm using Socialize SDKin my Android app project (API 18).
我在我的 Android 应用程序项目 (API 18) 中使用Socialize SDK。
I have read its Getting Starteddocumentation and followed the instruction on how to implement it.
我已阅读其入门文档并遵循有关如何实施它的说明。
However, I come across several problems regarding library imports. I've tried to put all the JAR files inside my project's /libs
folder but it couldn't locate the drawables, because clearly I haven't include their /res
folder.
但是,我遇到了一些关于库导入的问题。我试图将所有 JAR 文件放在我的项目/libs
文件夹中,但它无法找到可绘制对象,因为显然我没有包含它们的/res
文件夹。
So, I configured the Build Path of my project to include the Libraries. Now this error shows up:
因此,我将项目的构建路径配置为包含库。现在出现此错误:
[2013-11-20 10:11:04 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2013-11-20 10:11:04 - WebShopper] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
I have already imported Socialize project folder into Eclipse in order to use its libraries. But I couldn't figure out how to solve this error.
我已经将 Socialize 项目文件夹导入 Eclipse 以使用其库。但我不知道如何解决这个错误。
Here is how my Build Path currently looks like, if it helps:
这是我的构建路径目前的样子,如果有帮助的话:
What's wrong with it? Are there any duplicated libraries I have to remove here?
它出什么问题了?是否有我必须在此处删除的重复库?
If anything, please let me know.
如果有的话,请告诉我。
采纳答案by Shashank
I don't know exactly what is the problem, it may be because of same class definition in multiple jar files. I also had same problem once but resolved it by removing one jar file from my lib folder.
我不知道到底是什么问题,可能是因为多个 jar 文件中的类定义相同。我也遇到过同样的问题,但通过从我的 lib 文件夹中删除一个 jar 文件来解决它。
Here is some links which may help you out in coming out of this problem
这里有一些链接可以帮助您解决这个问题
Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;
回答by Pihu
This type of error occur because of multiple libraries or jar files in your project.Do the following:
出现此类错误的原因是项目中有多个库或 jar 文件。请执行以下操作:
- Delete the imported library first.
- Then clean your project.
- Go to project properties,then click on java build path, Library and then import jar.
- Then refresh your project and run again.
- 首先删除导入的库。
- 然后清理你的项目。
- 转到项目属性,然后单击 java 构建路径、库,然后导入 jar。
- 然后刷新您的项目并再次运行。
Hope this would help you..:)
希望这会帮助你..:)
回答by LokiDroid
Go to bin, dexedLibs of the project and delete the duplicate libs over there. The most common reason for this issue would be, a local version of the jar in the projects lib folder and in java build path the user may add the same jar again to the project. Which will reflect in the dexedLibs folder. Compiler wont be able to resolve the call to the exact class in this case. Delete the jars in the lib and in the dexedLibs. Clean and build.
转到项目的 bin、dexedLibs 并删除那里的重复库。此问题的最常见原因是,项目 lib 文件夹和 java 构建路径中 jar 的本地版本,用户可能会再次将相同的 jar 添加到项目中。这将反映在 dexedLibs 文件夹中。在这种情况下,编译器将无法解析对确切类的调用。删除 lib 和 dexedLibs 中的 jars。清洁和建造。
回答by Ajith Memana
For me the issue was that, i had added a lib project(autobahn lib) earlier and later switched the to Jar file of the same library.Though i had removed references to the older library project, i was getting this error. Following all the answers here i checked the build path etc. But i haven't added these libs to build path manually. So i had nothing to remove. Finally came across this folder.
对我来说,问题是,我之前添加了一个 lib 项目(autobahn lib),后来切换到同一个库的 Jar 文件。虽然我删除了对旧库项目的引用,但我收到了这个错误。按照这里的所有答案,我检查了构建路径等。但我没有手动添加这些库来构建路径。所以我没有什么可以删除的。终于遇到了这个文件夹。
bin/dexedLibs
bin/dexedLibs
I noticed that there were two jar files with the same name corresponding to autobahn Android which was causing the conflict. So i deleted all the jar files in the dexedLibs folder and rebuild the project. That resolved the issue.
我注意到有两个与高速公路 Android 对应的同名 jar 文件导致了冲突。所以我删除了 dexedLibs 文件夹中的所有 jar 文件并重建项目。那解决了这个问题。
回答by Steve
I solved this exception by placing all the jar files
in the same disk
.
我通过将所有的jar files
放在同一个disk
.
For Eg:D drive
including your project workspace
+jar files in the same drive.
例如:在同一驱动器中D drive
包含您的项目workspace
+jar 文件。
回答by Snow Albert
Whenever you meet this problem, you must read the message. From literally,We can see you have same class file in you project that is android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.
每当您遇到此问题时,您都必须阅读该消息。从字面上看,我们可以看到您的项目中有相同的类文件,即 android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl。
If you can't find those two library repeated? You just need to make a new project, and copy all jar files to the new project /libs directory. Run as--->it error--->Then you delete some jar-->Build project--->Run as.Util you delete some jar,The project is Run as normally,Then you unzip the jar file,you will find the class in the error message. Now, you find out the two library, just to decide delete one.
如果找不到重复的那两个库?你只需要新建一个工程,把所有的jar文件拷贝到新工程的/libs目录下即可。Run as--->it error--->然后你删除一些jar-->Build project--->Run as.Util 你删除一些jar,项目正常运行,然后你解压jar文件,你将在错误消息中找到该类。现在,你找出了两个库,决定删除一个。