Facebook SDK v.4 for Android: errors on Eclipse

后端 未结 3 369
盖世英雄少女心
盖世英雄少女心 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: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.

提交回复
热议问题