简体   繁体   English

Facebook SDK无法启动活动ComponentInfo

[英]Facebook SDK Unable to start activity ComponentInfo

I uninstalled my app and reinstall it though ADB and now none of the facebook stuff works. 我卸载了我的应用程序,并通过亚行重新安装它,现在没有任何facebook的东西工作。 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). (顺便说一句,代码与Android教程相同,当然也可以进行测试)。

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) 问题是,没有调用任何函数(onComplete,onFacebookError,onError或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. 在我的所有3台设备上试过这个没有安装facebook并且从未使用过应用程序。 Still crashes with the same error. 仍然崩溃同样的错误。

I call the facebook activity by doing the following: 我通过执行以下操作来调用facebook活动:

        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? 其他任何有这个错误/错误,并知道如何解决它?

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 . 如果它是facebook.authorize(...)上的NPE,那么你可能忘记了实例化facebook Make sure you instantiate it in the beginning of your onCreate method. 确保在onCreate方法的开头实例化它。

    Facebook facebook = new Facebook("YOUR_APP_ID");

Also make sure you have included our Facebook Android SDK as a library in your project. 还要确保您已将我们的Facebook Android SDK作为库包含在您的项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM