在開發Android項目的時候,有時需要引用多個項目作爲library。在引用項目的時候,有時會出現“Jar mismatch! Fix your dependencies”錯誤,具體如下:
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/***/libs/android-support-v4.jar
Length: 484258
SHA-1: bd6479f5dd592790607e0504e66e0f31c2b4d308
Path: /Users/***/libs/android-support-v4.jar
Length: 385685
SHA-1: 48c94ae70fa65718b382098237806a5909bb096e
Jar mismatch! Fix your dependencies
這是因爲兩個項目的jar包(android-support-v4.jar)不一致。
解決之道一:
解決方法是把2個jar都刪除,然後各自加上最新的jar包。
解決之道二:
把兩個項目的 android-support-v4.jar 刪一個,複製過去。這樣2個jar 包就一致了。
解決之道三:
把其他項目中的v4jar包,拿出來分別放到這兩個項目中去。