Facebook SDK Unable to start activity ComponentInfo

I uninstalled my app and reinstall it though ADB and now none of the facebook stuff works. The code is exactly the same as before but it just gives me the following error:

(BTW the code is identical to the Android tutorial stuff, for testing of course).

Following error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.polygonattraction.lovebirds/com.polygonattraction.lovebirds.facebook.FacebookLoginTest}: java.lang.NullPointerException

It seems to happen on this line:

facebook.authorize(this, new String[] {"user_photos","user_about_me","friends_photos","user_status", "publish_stream"}, Facebook.FORCE_DIALOG_AUTH, new DialogListener() 

The problem is, none of the functions are called (onComplete, onFacebookError, onError or onCancel)

which is strange, it just crashs on authorise. Tried this on all 3 of my devices one without facebook install and never had the app. Still crashes with the same error.

I call the facebook activity by doing the following:

        Intent intent = new Intent(this, com.polygonattraction.lovebirds.facebook.GetFacebookToken.class);
        startActivityForResult(intent, GET_FROM_FACEBOOK);

Any else have this bug/error and know how to fix it?

Answers


Can you paste the full stack trace?

If it's a NPE on facebook.authorize(...), then it's possible that you forgot to instantiate facebook. Make sure you instantiate it in the beginning of your onCreate method.

    Facebook facebook = new Facebook("YOUR_APP_ID");

Also make sure you have included our Facebook Android SDK as a library in your project.


Need Your Help

How to download and load file from the App directory to local

ios objective-c iphone

I have PDFs in my project. I want to give feature to download that file to mobile directory and load it with other apps.

disable setMovementMethod(LinkMovementMethod.getInstance()) on android

android android-edittext hyperlink

I'm using setMovementMethod(LinkMovementMethod.getInstance()) for EditText view in my android app.