Facebook SDK v.4 for Android: errors on Eclipse

后端 未结 3 368
盖世英雄少女心
盖世英雄少女心 2021-01-15 19:34

I am trying to import the latest version (4.0.1) of the Facebook Android SDK into eclipse but I am facing issues in having the project being properly built and imported as a

相关标签:
3条回答
  • 2021-01-15 20:07

    Android Facebook SDK import occurs with errors - Eclipse

    Check this out. May be this will help you. I faced same problem while working in Android Studio. But you are facing in Eclipse.

    0 讨论(0)
  • 2021-01-15 20:08
    1. Download the facebook sdk from here.
    2. Extract the zip file.
    3. Import only facebook sdk project into eclipse as "Existing Android code into workspace".
    4. Now, this project will show many errors, do not open any java file or resource file and do not try to do any imports or clean project until I mention it to do so.
    5. First add the v7 library to this project by doing right click on facebook sdk project >> properties>>android>>Add Library.(If you don't have latest v7 support library download it from sdk manager), also set the project build target to the maximum android version available and select "is library".
    6. Now, right click on facebook project and select >Build path>Configure build path>Libraries tab>Add external jars> browse to place where you extracted facebook sdk in step 2 and find two jar files in libs folder(android- support-v4.jar and bolts-android-1.1.2.jar) and add both files. Switch to "order and export" tab and select both the jar files and click on ok.
    7. Now right click on facebook sdk >>properties>>Java Complier>>set the "compiler compliance level to 1.7 or more and use default compliance settings.
    8. Now select the project and click on Project > Clean.

    This should remove all errors now. This is how it worked for me.

    0 讨论(0)
  • 2021-01-15 20:26

    I did some more tests and find out that by downloading the two libraries:

    android-support-v4.jar bolts-android-1.1.2.jar

    from the github project (https://github.com/facebook/facebook-android-sdk) did the trick.

    So the steps are the following:

    1. Download, unpack and import as android existing code into workspace the latest v.4 version of the Facebook SDK for Android.

    2. Download the two jars from GitHub

    3. Set the Facebook Project as "isLibrary"

    4. Add the two jars as "external jars" in the classpath

    5. Set the java compiler to 1.7

    6. clean and rebuild the project

    Now errors are gone.

    0 讨论(0)
提交回复
热议问题