I have implemented the new Facebook SDK 3.0 beta. The library project contains the Android support library v4. I also have the support library on my own proyect (a different version though). When I add the Facebook SDK as a library I get the next error on the console:
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.
I've tried to exclude the libs folder on the buildpath, but the error remains.
I have to put the same .jar in both places. Am I missing something here? The idea is to use the support library of my own project (to keep it updated).
It seems like the different projects are using two separate support libraries and therefore the checksum is different.
You must repeat this for both the Facebook SDK project and the app you are building.
What I do when I get this error is:
Right click the project.
Hover over Android Tools.
Click on "Add support library..."
Accept the downloading of the library.
This insures two things: a. you get the newest version of the support library from the Google sources, and b. you have the EXACT same library in all your projects.
Happy coding!
Simply delete the one in your project, remove it from the class path and try rebuild your project.
Installing the same version of support libraries via menus mentioned in the top answer is quite a good solution.
Although this sometimes didn't work for me (I think it has something to do with my Workspace folder being synced with Dropbox, so Eclipse won't overwrite files sometimes) so the approach I am using is to link the support library from the central place.
There are these JAR files inside your SDK folder (C:\Program Files (x86)\Android\android-sdk\extras\android\ on Windows for example) which is being updated when you run SDK manager, so you could just reference that one from both the Facebook (or any other library) and your projects. Since in the end, code from JAR files gets packed to your classes.dex. You don't even need the support library in the libs folder.
Also: If you use the Gradle build system and its dependency management or even Maven you will not have problems like these, but they require more time and knowledge to set-up correctly.
Related
I have basically just downloaded the newest android and eclipse bundle from Google, and upgraded the sdks to the newest versions. As well as installed the adt plugin.
Well... now all content of any library projects wont get recognized.
They are included fine as Libraries, but I get a red x whenever a class tries to reference anything from a library project. (Edit: the problem is that any library reference cannot be resolved.)
Nothing works. Cleaning, restructuring, restarting. The jars from the Library projects aren't being included in the bin folders anymore, and I can understand that that is from the new build system upgrade. But this also break everything!
Has anyone had a similar problem, and hopefully a solution?
(I am also running Windows 7 64 bit)
whatever library project you are using should have common support v4 jar file in lib folder,
so get the updated support v4 libary and replace all old v4 libary with that updated one.
still getting a error then post your logcat log
I'm using the Android SDK as a standalone version (since I don't like IDEs very much).
However, now I wanted to use the Support Libraries and downloaded them with the ./android tool. And I checked that the /extras/android/support/v4/android-support-v4.jar exists.
Yet, my compiler doesn't seem to recoginize them (error: package android.support does not exist).
I believe that I have to get them in my classpath somehow, but have no idea how this should work (on the android page it is only explained for IDEs).
Any suggestions?
While the Android Support library documentation focuses on the two main IDEs, the documentation on command-line projects has instructions on how to reference an Android library project.
I needed to specifically get the support libraries (a jar file) to be included in a legacy ant-based Android build, and I wasn't able to get the command line suggested by the links from CommonsWare to work (specifically, the suggestions from https://developer.android.com/tools/projects/projects-cmdline.html#ReferencingLibraryProject required that I actually have a full project to reference.)
As it turns out, all I had to do was put the support library jar (eg: android-support-v4.jar) in the project's lib directory and everything worked. That may be specific to the ant build I'm using, but I think it's the same build file that the google tools used to generate.
I'm writing an android app that uses both ActionBarSherlock and the Facebook Android SDK. Both these libraries provide android-support-v4.jar in their libs folder:
https://github.com/facebook/facebook-android-sdk/blob/master/libs/android-support-v4.jar
https://github.com/JakeWharton/ActionBarSherlock/blob/master/library/libs/android-support-v4.jar
However, in the head revision both versions of the support jar are different. This causes builds of my app using eclipse to fail.
I'm using both libraries by including them in the repo of my app as git submodules. One solution would be to fork one of these libraries, update the version of android-support-v4.jar in the fork, and point my submodule to the fork. While perhaps this is the right way to go, somehow this feels wrong.
I wanted to know if there were other alternatives before I use the above method. A number of popular Android libraries seem to use maven, is using maven a good solution for solving this problem, and a good idea for android apps in general?
First of all Delete android-support-v4.jar from All(yourProject,FacebookSDK etc. ).
Then follow below steps:
Right Click on Project -> Android Tools -> Add Support Library and The again Right Click on Project -> Android Tools -> Fix Project Properties do same on Facebook SDK and Other Libraries.
and Clean-Build all your projects(Facebook SDK,your Project and Libraries).You are Done.
Does anyone have any experience in making use of the Google play services library project in IntelliJ?
I recently purchased IntelliJ and want to make use of the Google play services library (specifically the mapping aspects of the library). In eclipse this works no problem but in IntelliJ all of the references to MapFragment etc are not being resolved.
I have done the following:
1) Imported the Google play module as a library project (marked it as a library project in the android facet)
2) Marked the google play library project as a dependency of my main application
Despite this it's not resolving the required imports.
Does anyone have any tips for how to enable the Google play services library in an IntelliJ android project?
http://youtrack.jetbrains.com/issue/IDEA-96525
Found the solution for folks out there.
You will need to add a dummy class to the src folder.
You'll also need to add the google-play-services.jar to your module as a jar dependency.
I tried a lot of suggestions on stackoverflow.com. However, I was able to get the project to build and run in IntelliJ IDEA 12.0.2 by
Copying the google-play-services.jar file located within my android sdk directory to the ./libs directory in my Android project
Re-importing the project (e.g., on Mac OS X, open IDEA and go to File -> Import Project...) into IntelliJ IDEA.
Follow the steps in the wizard carefully. You should be able to see that IntelliJ IDEA recognizes the google-play-services.jar archive (it's checked). This worked for me. The problem appears to be a bug.
The confusion here is that you need to add the google play libs as an android library project, not the JAR. You also need to make sure import a copy of the the library project, not directly out of the android sdk folder.
In your IntelliJ Project, open the Android SDK Manager in the tools/Android menu.
Scroll to the bottom of the SDK Manager and choose to install the google play sdk.
Go to the extras folder in your android sdk directory and copy google-play-services_lib folder to somewhere handy for you
Open your module settings F4, right click your module and select to add a module. Follow the guide for adding a module from existing sources.
This way, you've added the google play android library project to your project, not just the jar.
So the way to do this is to build goole-play-services.jar from IDEA and then include the jar file as a dependency.
I have several Android Projects marked as "Library Projects". I also have several Projects which use them, obviously.
The problem is, sometimes if I restart eclipse, all those Classes used from Library Projects are marked as "Not Found" and I can't quickfix that (using imports, etc.)
The only way I can fix it is right-click the project which includes library projects, remove all library projects, apply, then add them again. That is REALLY annoying, and I'd like to fix this permanently.
The Projects are using Android Library Projects and are not Library projects themselves. Eclipse Version: 3.7.1 Build id: M20110909-1335
Try upgrading your Eclipse ADT plugin to the 15.0.1 release that shipped earlier this week. After one last fixup using the steps you outlined above, I haven't had a recurrence of this problem.