android-support-v4.jar dependency error

2019-04-28 16:19发布

问题:

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?

回答1:

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 (:



回答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.



回答3:

  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


回答4:

  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