Android facebook SDK doing error java.lang.NoClassDefFoundError‎

前端 未结 10 801
时光取名叫无心
时光取名叫无心 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:17

    I also had this exception and tried almost everything i found. But then i copied the facebook sdk project to my workspace folder and then referenced it from there in my project and it worked.

    Don't know why this happened, this made no sense to me as i was providing it the path while adding reference but anyways, It solved the problem.

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

    I had similar problems. I am building one my lib project (with activities) and my main project using this lib. I had these problems. I had added the lib under the Project properties/Android section and at the bottom, as suggested correctly before, but this wasn't enough (note that both projects were compiling good). I had to change the lib project and use the full path to the layout as:

    setContentView(com.example.mylib.R.layout.activity_main1);
    

    Note that using just R.layout wasn't enough, although I have defined the:

    import com.example.mylib.R;
    

    Valid alternative is however:

    import com.example.mylib.R.layout;
    setContentView(layout.activity_main1);
    

    Using Eclipse.

    hth to someone

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

    I too faced the same problem. I was able to overcome this issue by placing the Facebook SDK library as well as my project(to which I want to link the Facebook SDK) within the same workspace. Now go to your project->right click->properties->android->scoll down->add->select the path to facebook SDK->press ok.

    This way you can link the Facebook SDK to your project. Only adding the Facebook jar will result in an exception as this does not contain all the classes.

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

    Right click on the Project. Choose Properties -> Android. Under Library click on the Add... button and select the path to the Facebook SDK Project.

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