Jar Mismatch Found 2 versions of android-support-v4.jar in the dependency list

JavaAndroidJar

Java Problem Overview


I am trying to create 2 versions of an Android app (free/paid). I have an Android Library that contains files common to both. I created a new Android project and am trying to use the Library but get the error below:

Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
All versions of the libraries must be the same at this time.
Versions found are:
Path: /Users/Zaheer/Developer/App Free/libs/android-support-v4.jar
	Length: 349252
	SHA-1: 612846c9857077a039b533718f72db3bc041d389
Path: /Users/Zaheer/Developer/App Library/libs/android-support-v4.jar
	Length: 337562
	SHA-1: 27c24d26e4c5d57976e6926367985548678e913c

Any ideas on how to resolve this? I've been playing with the build path to no success.

Java Solutions


Solution 1 - Java

> Any ideas on how to resolve this?

Delete one.

> I've been playing with the build path to no success.

Step #1: Undo all that. If you are messing with the build path, on R16 or higher version of the ADT plugin for Eclipse, you're doing it wrong.

Step #2: Pick one of those two versions of the JAR, or pick the one from the "extras" area of your SDK installation.

Step #3: Put the right JAR in App Library.

Step #4: Delete the one from App Free, since it will pick up that JAR from App Library.

You are welcome to instead have the same actual JAR file in both spots (App Free and App Library), though that just takes up extra space for no reason.

Solution 2 - Java

  1. Delete android-support-v4.jar from App Free
  2. Add the same file from App Library to App Free

Solution 3 - Java

Above solutions mostly solve the problem. after using these solutions and problem persists. Then

> GO to project folder -> libs-> and delete "android-support-v4.jar"

Hoping it would solve your problem as it solved my problem.

Solution 4 - Java

There are some scenarios where you have multiple library projects having the the android-support-v4.jar in their libs and build paths and your project has a dependency towards both of them. Say for example in my case I have the following library projects in my workspace,

  • libfacebook
  • libsherlockactionbar

Both these projects are independent and my project.properties looks like the following,

# Project target.
target=android-17
android.library.reference.1=../libfacebook
android.library.reference.2=../libsherlockactionbar

When I build my project, I get a jar mismatch problem having duplicate references to two copies of the same file. What I did to solve this issue is a bit of trickery. I created a new library project named libcommons as a parent to all the other library projects in my workspace, including libfacebook and libsherlockactionbar. Then I removed the support library from all other projects and kept only one copy inside libcommons's libs folder. Then I have added libcommons as a reference to all my other library projects. Once cleaned my workspace, everything works like a charm.

Solution 5 - Java

This is a more elegant fix than deleting and adding files!

You just need to :

  1. Right Click the project App Free
  2. Go To "Android Tools" > "Add Support Library"
  3. Approve the permissions and let it update the library
  4. Repeat this process for the project App Library

The Android Support Library will then be in sync (:

Solution 6 - Java

VERY SIMPLE SOLUTION

A very simple solution worked for my case, just copy the same (android-support-v4.jar) jar file to all the projects. There will be no more conflict.

1 Copy the jar file android-support-v4.jar from libs folder of any one project.

2 Delete the jar file android-support-v4.jar from second project's libs folder which is already existing.

3 Paste the newly copied jar file of first project to libs folder of second project.

The jar mismatch issue will be resolved by now.

Solution 7 - Java

Just copy the library from one of the projects to the other one. Maybe the timestamp needs to be the same on both.

Solution 8 - Java

Resolution:

  1. Right click on 'free' project > Android Tools > Add Support Library.
  2. Do the same thing on 'paid' project.
  3. Clean all projects

Solution 9 - Java

Check if there are irrelevant projects open for you, because that was the case for me, it seemed one of the JAR files was related to a different project, which I wasn't working with, so I just closed that project, did a clean build of the project I'm working on and didn't have the problem anymore! Hope this helps someone!

Solution 10 - Java

Use same jar while adding external jars in both library and project

Solution 11 - Java

well.. it works for me:

Go to

> Project folder > libs

then, delete "android-support-v4.jar"

Then

> project > Clean

It will work!

Solution 12 - Java

I just had this issue, but instead of deleting the conflicting android-support-v4.jar I just renamed it to android-support-v4_PROJECT.jar, which removed the conflict.

If you are wondering how to rename a file in Eclipse, you just need to highlight the file and press F2.

Solution 13 - Java

You just need to have exactly the same android-support-v4.jar checksum on each of your projects. For this, you can copy/past one of them in all of your conflicting projects / library.

Nothing else to do, clean and enjoy :)

Solution 14 - Java

May be you open 2 project same time (both using android-support-v4.jar) . I close 1 project and every thing ok

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
QuestionZaheerView Question on Stackoverflow
Solution 1 - JavaCommonsWareView Answer on Stackoverflow
Solution 2 - JavaLee Chun HoeView Answer on Stackoverflow
Solution 3 - JavaNauman KhalidView Answer on Stackoverflow
Solution 4 - JavaC--View Answer on Stackoverflow
Solution 5 - Javacokeby190View Answer on Stackoverflow
Solution 6 - JavagprathourView Answer on Stackoverflow
Solution 7 - JavaRafael SanchesView Answer on Stackoverflow
Solution 8 - JavastrawberrywineView Answer on Stackoverflow
Solution 9 - JavaArturas MView Answer on Stackoverflow
Solution 10 - JavaPratik KanadeView Answer on Stackoverflow
Solution 11 - JavaErick GuerreroView Answer on Stackoverflow
Solution 12 - JavaeBehbahaniView Answer on Stackoverflow
Solution 13 - JavatrypView Answer on Stackoverflow
Solution 14 - JavaGrey WolfView Answer on Stackoverflow