7

I just created a new blank Android project with minsdk as 2.2 in the latest Eclipse Luna.Eclipse automatically added an android-support--v4.jar in the libs folder of the project. This is causing an error in the console :

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: /home/faizal/DEV/ADT workspace/myNewProject/libs/android-support-v4.jar
    Length: 758727
    SHA-1: efec67655f6db90757faa37201efcee2a9ec3507
Path: /home/faizal/DEV/ADT workspace/appcompat_v7/libs/android-support-v4.jar
    Length: 648327
    SHA-1: ded9acc6a9792b8f1afc470f0c9cd36d178914cd
Jar mismatch! Fix your dependencies

This is because I also have an appcompat_v7 support library project, which I am using for another project and was created by an older Eclipse(i think it was Juno..it was part of the ADT bundle).

I know the solution is to remove one of the jars, but which one and why?

faizal
  • 3,497
  • 7
  • 37
  • 62

4 Answers4

18

You just need to :

  1. Right Click the project myNewProject
  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 appcompat_v7

The Android Support Library will then be in sync (:

cokeby190
  • 609
  • 7
  • 14
  • That worked. I guess what happened was that the `appcompat_v7` project had the older version of the v4 support library. I guess i could have done the "Add Support Library" only for `appcompat_v7` and it would have worked. – faizal Jul 07 '14 at 11:22
  • Glad it helps! (: The next time you get a similar error you can try this fix – cokeby190 Jul 07 '14 at 11:24
  • My guess is that the `sdk manager` would update the `sdk/extras/android/support/v7/appcompat/libs/android-support-v4.jar` with the latest, which would be then imported by any new projects. But the already existing projects would still be having the older library. And this would cause the error. – faizal Jul 07 '14 at 11:33
  • Yup, when the android library is mismatched it will cause this error. If this for some reason doesnt work in the future, you can also delete the android-support library jar file, and copy the appcompat android-support jar file to the existing projects. But this fix is more elegant than the delete and copy obviously. haha. – cokeby190 Jul 07 '14 at 11:36
  • 1
    In testing, I removed the appcompat_v7 from the projects list, so I could not update it. If you do so, just menu "File/Import..." then "General/Existint Projects into Workspace" then select your appcompat_v7 from inside your workspace and it will be there again. Of course you should have not removed the content from disk when removing the project, otherwise it will not be there to rescue it ;) – Xavi Montero Oct 18 '14 at 09:46
2

You import a appcompat_v7 library which also have a android-support--v4.jar, but different size. Just copy android-support--v4.jar from your project library to appcompat_v7 folder. Folder paths are in your post, just for information.

Michal Žídek
  • 464
  • 2
  • 17
  • But i never imported appcompat_v7 for my newer project. It automatically got listed in the `Android Dependencies` folder of my new project. Any idea why? – faizal Jul 07 '14 at 11:05
  • 1
    Probably because you choose old SDK as your minsdk. That wizard might be kinda broken, but what I've just wrote, will solve this problem. appcompat_v7 library allows you create action bar on older SDKs, if I am not mistaken, so you probably want to have it. – Michal Žídek Jul 07 '14 at 11:08
0
  1. Right Click the project demoProject
  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 appcompat_v7 (or any library
dirkk
  • 6,160
  • 5
  • 33
  • 51
Vaishali Sutariya
  • 5,093
  • 30
  • 32
0
  1. Look at the paths of the discrepancies
  2. Delete the one under the project > libs folder
  3. Copy the one from the appcompat libs folder to the project libs folder
  4. Close and reopen Eclipse
  5. Clean project
MeCurious
  • 1
  • 1