Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android-support-v7-appcombat jar mismatch and app crashing after Android 4.4 SDK update

I have been successfully using android-support-v7-appcompat library for last few months in my app to support action bar in older devices. Recently I have downloaded the Android 4.4(kitkat) updates with system image and SDK platform from the SDK Manager. I also added targetSdkVersion to "19" in manifest file. But my project was showing error as 'android-support-v7-appcompat jar mismatch. Fix your dependaecies.' Then I added the jar from /extras/android/support/.... to the project as an external jar using build path menu > add external jar. Now there is no error in the project and android-support-v7-appcompat.jar & android-support0v4.jar file is showing twice under 'Referenced Libraries' folder and also once under 'libs' folder. The project is not showing error and running, but crashing in different activities.

Previously I imported the android-support-v7-appcombat library as an external project in the workplace. I can see error in that project. Please suggest what should I do now. Also, android-support-v7-appcompat.jar umder Android Dependencies in Java Build Path showing error.

The error I see is:

Found 2 versions of android-support-v7-appcompat.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: C:\<project hierarchy>\libs\android-support-v7-appcompat.jar

Path: C:\Users\....\sdk\extras\android\support\v7\appcompat\libs\android-support-v7-appcompat.jar

 Jar mismatch! Fix your dependencies

After getting idea from different forum, I removed all the android-support-v7-appcompat libraries from different places, and imported android-v7 support library again in the project. Still it's showing error. Should I also delete android-support-v4 libraries from buildpath and libs/private librariry/referenced library folders?

like image 664
MSIslam Avatar asked Jan 12 '23 21:01

MSIslam


1 Answers

This error occurs when there are multiple and different instances of the same library are found in the same project, or libraries used by it. A very simple way to resolve this is use the common lib at both the places. To do so:

Just copy your C:\Users....\AppData\Local\Android\android-studio\sdk\extras\android\support\v7\appcompat\libs\android-support-v7-appcompat.jar and paste it in your libs folder, replace the old one with this. Clean the project, and it shall compile now..

Edit 1: Basically the idea is if you are using the same libraries, it shall be the common jar, or the same jar. In your case if you are using the appv7 as an external project, please go to libs folder of your project copy android-support-v4.jar, and paste into the libs of android-support-v7-appcompat project.

Also, make sure if there are other external jars or support libraries used by you, they shall be the similar jars in all the projects you are using.

I hope it helps!

like image 93
Vivek Soneja Avatar answered Jan 14 '23 10:01

Vivek Soneja