Jar mismatch! Fix your dependencies

AndroidEclipseJar

Android Problem Overview


Steps to reproduce:

  1. create a android project "MyApp"
  2. import ActionBarSherlock(ABS),Directional ViewPager(DVP), or any other open source library which use android support library.
  3. Add the libraries to the project "MyApp"

Console log:

[2013-04-17 14:27:12 - MyApp] Found 2 versions of android-support-v4.jar in the dependency list,
[2013-04-17 14:27:12 - MyApp] but not all the versions are identical (check is based on SHA-1 only at this time).
[2013-04-17 14:27:12 - MyApp] All versions of the libraries must be the same at this time.
[2013-04-17 14:27:12 - MyApp] Versions found are:
[2013-04-17 14:27:12 - MyApp] Path: C:\Users\santhosh\My_Workspace\DVP_library\libs\android-support-v4.jar
[2013-04-17 14:27:12 - MyApp] 	Length: 140011
[2013-04-17 14:27:12 - MyApp] 	SHA-1: fc834ac8147bc4ed0b555f90f500a57d4232c448
[2013-04-17 14:27:12 - MyApp] Path: C:\Users\santhosh\My_Workspace\abs_library\libs\android-support-v4.jar
[2013-04-17 14:27:12 - MyApp] 	Length: 271754
[2013-04-17 14:27:12 - MyApp] 	SHA-1: 53307dc2bd2b69fd5533458ee11885f55807de4b
[2013-04-17 14:27:12 - MyApp] Jar mismatch! Fix your dependencies

I know i am suppose to delete android-support-v4.jar from libs folder and keep only one copy for all. But, that is not solving my problem.

When i try to delete the android-support-v4.jar from MyApp, it gives me the following error.

 Problems encountered while deleting resources.
 Could not delete 'C:\Users\santhosh\My_Workspace\MyApp\libs\android-support-v4.jar'.

When I try to delete the android-support-v4.jar from ABS, it gives me the following error

 ????? cannot be resolved to a type error.

I have tried to clean the project, Fix Project Properties. Restart eclipse, Build, import and add again. I have tried to copy the support jar in libs folder from one library to other. delete the support jar in both libraries and add it to the MyApp project. Nothing has worked for me.

if i try to add single library, it works fine. i am facing the problem when trying to add 2 or more libraries to a single project.

error getting when I add two libraries in MyApp:

The project was not built since its build path is incomplete. 
Cannot find the class file for android.support.v4.app.FragmentActivity. 
Fix the build path then try building this project MyApp Unknown Java Problem
The type android.support.v4.app.FragmentActivity cannot be resolved. It is indirectly referenced from required .class files	MyActivity.java/MyApp/src/com/santhosh/myapp	line 10	Java Problem
Jar mismatch! Fix your dependencies	MyApp Unknown Android Dependency Problem

Android Solutions


Solution 1 - Android

Don't Include the android-support-v4 in the library , instead you can add it to your project as an external jar using build path menu > add external jar

Sometimes you have to clean your project.

Solution 2 - Android

Use a Library Project just for the Support Library

As of ADT 22, using Eclipse Juno

I don't think any of the above are really the best answers. I also don't think it is recommended to use the external jar function in Eclipse anymore (AFAIK).

Rather, what worked for me is to create a separate empty library project.

Then use Android tools > Add Support Library to get the latest version you need or want.

Then remove the support lib jar from all other projects.

Finally, for every project that requires it, add a reference to your new Library project

(project properties) > Android > (Library box) > Add...

Then all your projects will have a single source to use and update the support library. This also makes javadocs easier to get working.

For info on how to setup the javadocs see:

https://stackoverflow.com/questions/9873152/how-to-attach-javadoc-or-sources-to-jars-in-libs-folder

Solution 3 - Android

Remove android-support-v4.jar file from the libs folder from your project.

Solution 4 - Android

Actionbarsherlock has the support library in it. This probably causes a conflict if the support library is also in your main project.

Remove android-support-v4.jar from your project's libs directory.

Also Remove android-support-v4.jar from your second library and then try again.

https://stackoverflow.com/questions/12045568/jar-mismatch-found-2-versions-of-android-support-v4-jar-in-the-dependency-list

Solution 5 - Android

I agree with pjco. The best way is the official method explained in Support Library Setup in the tutorial at developer.android.com.

Then, in the Eclipse "package explorer", expand your main project and delete android-support-v4.jar from the "libs" folder (as Pratik Butani suggested).

This worked for me.

Solution 6 - Android

  1. Jar mismatch comes when you use library projects in your application and both projects are using same jar with different version so just check all library projects attached in your application. if some mismatch exist then remove it.

  2. if above process is not working then just do remove project dependency from build path and again add library projects and build the application.

Solution 7 - Android

I believe you need your support package in both Library and application. However, to fix this, make sure you have same file at both locations (same checksum).

Simply copy the support-package file from one location and copy at another then clean+refresh your library/project and you should be good to go.

Solution 8 - Android

I think you create a new workspace and import all project properly with his lib and also add external jar android-support-v4.jar in adb bundle in sdk extra files. I think its work for you. Hope all the best

And also use the android support lib it may be help you and also update your adt bundle

Solution 9 - Android

In my case there was another directory within my workspace, having the same jar file as the one in my project. I hadn't created that directory or anything in it. It was created by Eclipse I believe. I just erased that directory and it just runs ok.

Solution 10 - Android

Right click on your project -> Android Tool -> Add support library

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSKKView Question on Stackoverflow
Solution 1 - AndroidMuhannad A.AlhaririView Answer on Stackoverflow
Solution 2 - AndroidpjcoView Answer on Stackoverflow
Solution 3 - AndroidPratik ButaniView Answer on Stackoverflow
Solution 4 - AndroidRaghunandanView Answer on Stackoverflow
Solution 5 - AndroidnettieView Answer on Stackoverflow
Solution 6 - AndroidGopal SharmaView Answer on Stackoverflow
Solution 7 - AndroidwaqaslamView Answer on Stackoverflow
Solution 8 - Androiduser4004473View Answer on Stackoverflow
Solution 9 - AndroidBarbaros ErdogduView Answer on Stackoverflow
Solution 10 - Androiduser5999064View Answer on Stackoverflow