I am working on an android app which uses the Facebook SDK (using the latest version, 3.6). This is my first time working with the SDK and trying to get up the simple login page work based on the example code available in the samples (scrumptious). I am unable to resolve the LoginButton in my xml layout. It is unable to reference com.facebook.widget.LoginButton. I tried copying the class file LoginButton source into my own class named FBLoginButton and then edited the layout file to look like this:
<!-- <com.facebook.widget.LoginButton -->
<!--<com.facebook.scrumptious.LoginButton -->
<com.example.myproject.FBLoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" />
While my class FBLoginButton is free of errors in itself, I get the error:
The following classes could not be instantiated:
- com.example.insultdroid.FBLoginButton (Open Class, Show Error Log)
I have already spent endless hours trying to get the LoginButton to work but to no success. Rebuilding, cleaning, restarting eclipse; I have done it all! Can someone please help me!
Adding a snapshot that shows that LoginButton class is available in the facebooksdk.jar which I have added to the dependencies.
The project you're working on... have you imported the Facebook SDK and added the library to your current project? (right click > Project > Android > Add... button in library section). Or check your Java build path -> Order and Export and make sure the facebook library is checked.
If you have, then it should work..., if you haven't, add the library and it should work.
Also, make sure under Android dependencies > facebooksdk.jar, that you see com.facebook.widget.LoginButton.
If it's still not working, try deleting the facebook library, re-adding it, close and restart Eclipse.