Android facebook SDK doing error java.lang.NoClassDefFoundError‎

前端 未结 10 800
时光取名叫无心
时光取名叫无心 2020-12-09 05:57

I have just downloaded the facebook SDK from http://github.com/facebook/facebook-android-sdk I unpack it from git and opened Eclipse. I then created a new project using exis

相关标签:
10条回答
  • 2020-12-09 06:11

    Try to mark the check-boxes in Properties -> Java Build Path -> Order and Export.

    I had the same problem with the UiLifecycleHelper, and checkig both the Android Dependencies and the android-support-v4.jar worked perfectly. Better to run a clean after that.

    0 讨论(0)
  • 2020-12-09 06:11

    The new facebook SDK already had android.support.V4.jar.

    And when you create a new android application, even that contains one.

    Hence when you check the console, you get error message called JAR mismatch.

    In that case select properties of android project -> Java Build path ->

    Select Library tab -> Remove android.support.V4.jar Select Order and Export and uncheck -> Reference libraries (android.support.V4.jar)

    This will fix the issue.

    0 讨论(0)
  • 2020-12-09 06:14

    I had your same problem, and there was a suggestion in another question thread to export the Android Facebook SDK as a jar file and add that file to your project.

    Although some people said that the previous solution worked with them, it didn't work with me!

    The only thing worked with me is: coping the Android Facebook SDK six classes into my project and that solved my problem.

    Steps:

    1- I simply copied the following 6 classes from the Android SDK into my project AsyncFacebookRunner.java DialogError.java Facebook.java FacebookError.java FbDialog.java Util.java

    2- I've also copied the facebook_icon.png file from the drawable folders to my drawable folders.

    3- I imported my R.java class in the the copied FbDialog.java class.

    My advice is to try the jar solution first (as it is the neat way to be a developer), if it didn't work with you, then try my solution (as it is a way to solve the problem).

    Thanks and hopefully it will solve your problem.

    Mohamed.

    0 讨论(0)
  • 2020-12-09 06:14

    I had this same problem. I solved it just by following these steps:

    1. Remove all the sample projects and the Facebook SDK from Eclipse
    2. Import the SDK and sample projects again, but this time, using the "Copy projects into workspace" option checked.
    3. Rebuild the SDK and the sample projects
    4. Working!
    0 讨论(0)
  • 2020-12-09 06:15

    I managed to overcome this error by doing a clean build for both my project and facebook library (referenced) project.

    The steps:

    On Eclipse:

    1) Select Project -> Clean
    2) Select both your project and facebook sdk project
    3) select OK
    
    0 讨论(0)
  • 2020-12-09 06:16

    download bolts-android1.1.2 and put into \libs folder. then open the project properties-> java Build Path-> Project tab , Add Facebook SDK. (Facebook SDK libs must be attached with project)

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