I'm encountering a lot of jar mismatch errors lately and I'd like to avoid them in the future.
So, here's my question: suppose I have an app that uses 2 library projects, both of which use the v4 support library jar. In total, I have 3 jar files. What can I do to avoid the jar mismatch error?
All I've read so far is the case where you have a project and a single library project. In this case, I think your supposed to delete the jar file in the project and keep the one in the library project.
This is quite common if your project references several libraries, and each library references the same other library.
An example of this, your app is referencing the android support library v4, and you have 2 libraries which are also referencing the support library v4.
If you update your apps reference to the support library, but you don't update the support library v4 in your other libraries you will see this error.
The best thing is on each referenced library and your app, right click on the project > android tools > add support library. This will get the latest version and you should no longer see these errors.
If you're facing mismatch issue then simply copy one of them and paste in remaining libraries. E.g. as you've 3 v4 support library jars then copy one of them and paste at place of remaining two jars.
Try to understood by my example I used Map and Facebook in My project now Facebook,Map and my project have Android support jar so i removed Android Support jar from Facebook,My project but remain jar on Map,now i'm addded Android-Map-Extension as library project on Facebook And finally add Facebook library project on My project .....
Related
I have the latest Android Support library with Rev 22.2.1. I included the AppCompat v7 library from my SDK it in my workspace by following the guideline at the Android developer guides. Initially it included the project named appcompat_v7 in my project explorer. So far so good.
Then after creating a few projects and including a few other libraries like recyclerview and cardview and some third party library projects, I now notice two projects named appcompat_v7 and android-support-v7-appcompat in my project explorer.
This wouldn't bother me but now whenever I want to add the appcompat v7 library in my project, I am given both the options, and I get confused about which one to use. So the question is that where did android-support-v7-appcompat come from, and which one should I use when I want to include the v7 library in a project (also provided that the project is also using another third party library project).
Select Second Option AppCompat_v7
AppCompat_v7 is actually Android Support library which is introduced recently and is required for Application Compatibility for older versions of Android.
Please select second library (AppCompat_v7) as mentioned in above comment.
You can also read below articles if you need more info:
https://developer.android.com/tools/support-library/index.html
https://developer.android.com/tools/support-library/features.html
When i create a new Android project with min sdk as 2.2 in Eclipse , the support libraries are automatically added to Android Private Libraries, Android Dependencies and libs. That's probably because I had setup a support library project(appcompat_v7) earlier as per https://developer.android.com/tools/support-library/setup.html.
So my question is there a better way to include the support libraries in a project rather than have it appear all over the place? Is this the expected way?
Latest ADT automatically creates a new Android library project called appcompat_v7 in your workspace. This library project contains all the jar-files needed for supporting older Android version.
When you create a new Android application project, it will automatically receives a new dependency on that library project. It looks there is a small bug in ADT causing android-support-v4.jar to be added twice. You can safely remove android-support-v4.jar from the libs folder, as this jar-file is already available in appcompat_v7.
The best practice would be to keep a dependency on appcompat_v7 and delete duplicated android-support-v4.jar file.
I want to add multiples libraries on Android, but every one of them have the support library v4, and need them. I want to add : android-support-v7-appcompact, facebookSDK, PullToRefresh, google-play-services_lib.
I have DEX errors and NoClassDef errors every time.
For each project right click > Android Tools > Add Support Library
Although the support library is already added to the project it will download and install the latest version of the support library.
If you do this for each library project you should no longer see the error.
Hope this helps.
If the support library versions are not same there'll be error.
Either copy one of the support library v4 to all of them or delete all of the support libraries and just leave one of them
im writing an app that uses action bar sherlock and facebook sdk.
Therefore i imported those two libraries into my project and i get and error
saying i have two jars of android-support-v4.jar
"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."
what can i do? can i put one of the jars into the other library?
they supposed to identical, but their sizes are diff..i dont wana go and change/delete libraries in the sourcode.
any ideas?
Jar mismatch problem is happened because there are 2 versions of android-support-v4.jar in the dependency list one of them is included in Facebook SDK library and the other in ActionBarSherlock library.
The fix to this problem is to delete the android-support-v4.jar from one of these two library and copy the other android-support-v4.jar instead of the deleted one, in this way you will be sure you have the same version of the jar file in both libraries and you will get ride of the build error.
adding one as a jar and the other as a library. still i have two diff android-support-v4.jar's but it seems the compiler can live with it. so every library as it seems uses its own android-support-v4.jar.
I'm currently working on a project where I use multiple libraries. Multiple libraries use the android support library, so when I want to compile my app Eclipse complains about it with a Dalvik error. I already found out that I should only have the support library 1 time in my project. But, this breaks the library projects which causes that I cannot compile anymore.
How should I properly handle this?
If you use support library such as v4 and your project contains other library projects, you should keep the only one version of the v4 library. Choose one of the library file (the one that has the biggest size for example), remove all the duplicates and then copy this v4 into each project library which uses it.
Check if any of your libraries include the support library already. Maybe it's failing because it's already included.