Strange error when trying to use the android v7 appcompat library

三世轮回 提交于 2019-12-08 16:41:49

问题


I have just included the android v7-appcompat library in my project.I have successfully added the jars to the build path and am now using the Theme.AppCompat theme.Now,I get this strange error:

[Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback; [2013-10-09 11:11:50 - DelTest2] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback;

EDIT

My project now contains three folders,each of which contains the android v7 appcompat:

+Android Private Libraries
+Android Dependencies
+Referenced Libraries

Which one of these libraries must I delete in order to make my project work?


回答1:


Its showing error that your project contains multiple android-support-v4.jar.

One which is actually in your project and another is in the library which you have added in your project. Just remove the one library which you have added in your project. And then clean and run your application.

That's it.




回答2:


First, I removed all the jars from the build path and then went on to add the jars from the android v7 appcompat library. This created a Reference Libraries folder in my project where these two libraries were referred to.

Also, I found that the theme that comes with the appcompat library is dark. Instead, I am using the AppCompat.Light theme.




回答3:


Remove android-support-v4.jar from project as it already exist in library




回答4:


Just use android v7-appcompat library project, and most important of all,

make sure that this library project DO NOT depend on the android-support-v7-appcompat.jar, if you have already download the source files of support v7 and unzip them into /src folder.

This works well for me.




回答5:


I used this post to solve my problem: Unable to execute dex: Multiple dex files define

I just went to Configure Build Path and unchecked the step to a reference of the v7 jar since I noticed that I had a reference to the v4 in my project's libs folder already.




回答6:


I had the same problem, and my solution is to disable incremental dex. To do this open File > Project Structure > <Your gradle module name>, then in Properties tab set Incremental Dex to false.




回答7:


I had the same problem and to resolve it i clean the project (Build > Clean Project) and then rebuild it.



来源:https://stackoverflow.com/questions/19269355/strange-error-when-trying-to-use-the-android-v7-appcompat-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!