• 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

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:

  1. Right click the project.

  2. Hover over Android Tools.

  3. Click on "Add support library..."

  4. 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!

  • 122
Reply Report
    • Ok, so i have to update both (my proyect and FB's library proyect) every time there is an update on the support library? point b is something i didn't thought about. Thanks!
      • 2
    • A lot of answers tell people to delete one jar but I had 2 separate library projects with their own support jars inside so I couldn't delete any, it was bugging me for ages but by applying your solution to all my library projects the jar mismatch error disappeared! Thanks so much!
      • 1
    • thank you very much. For us noobs, please update your answer indicating that this has to be done on both projects.

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.

  • 1
Reply Report