Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Import Android Facebook SDK4 in eclipse

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5
    • 0
    • 706
    Comment on it

    Hello Readers,


    In today's post we will learn to import Android Facebook SDK in eclipse. We faced several problems when import Facebook SDK in eclipse. To import we need to follow the steps as mentioned below:

     

    • First of all, we need to download latest Facebook SDK- Click here. After download now unzip it in a folder.

     

    • Now open eclipse and import the project. Right click on Package explorer > select import. Then a window will appear and click on Android > select Existing Android Code Into Workspace. Now click on browse and select the folder where you unzip the Facebook SDK.

    Note: Select only Facebook project and unchecked all other projects we do not need them as they are sample projects.

     

    Importing the project :

     

     

     

     

    • After add Facebook project in eclipse we will see there are lots of error in the whole project.

     

    • In the project we will see most of the errors occur due to SDK tried to import support.v4 library. You can find support.v4 library in ADT bundle of eclipse > sdk > extras > android > support > v4.

     

    • Now we have to add the support.v4 library in Facebook SDK project. To add the library right click on the project > Properties > Java Build Path > Libraries > Add External Jars and goto the folder where is the support library stored.

     

     

     

     

    • Now we can see most of the errors were fixed after adding the library. Now will move to the other errors. In AccessToken.java file we find an error when we move the mouse pointer on it eclipse shows the hint on the error i.e the '<>' operator is not allowed for source level below 1.7. It will show two fixes for the error we can fix the error by click on Change project compliance and JRE to 1.7 or we can fix it manually right click on the project and select Properties > Java Compiler > Compiler compliance level > 1.7 .

     

    We can fix the error by click on Change project compliance and JRE to 1.7 :

     

     

    Or we can fix it manually change the compliance level from 1.6 to 1.7 in Java Compiler section.

     

    will

     

     

     

    • Now we are facing another error i.e Facebook SDK can't find required Bolts Android library. Now we need to add the required Bolts Android library we can search on Google or click here for download. In my project, I am using bolts-android-1.1.2 version. After downloading the library now add it to the project right click on project > Properties > Java Build Path > Libraries > Add External Jars and add the library from you save the file.

     

     

     

    • After complete all above steps, you will see all of the errors are gone.

     

    • Do not forget to final setup in the Facebook Project. Right click on project click on Properties > Android > select Is Library.

     

    •  Now clean the whole project so that all files can build properly.

     

    This is the easiest way to import Facebook SDK in eclipse and we can add the Facebook library in our Android app.

    Hope this will help you :)

    Import Android Facebook SDK4 in eclipse

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: