一定要进应用的时候确保首先调用facebooksdk.sdkinitialize()
所以在application中oncreate方法中调用以下方法:
FacebookSdk.setApplicationId("你自己的id"); //初始化Facebook SDK FacebookSdk.sdkInitialize(getApplicationContext()); if(BuildConfig.DEBUG){ FacebookSdk.setIsDebugEnabled(true); FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS); }