Error compile in “Use Facebook Login example”

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 08:08:27

问题


I'm trying to create the Login Application in this tutorial:

I'm getting this error in my logcat:

11-22 15:57:53.863: E/AndroidRuntime(816): com.facebook.FacebookException: Cannot use SessionLoginBehavior SSO_WITH_FALLBACK when com.facebook.LoginActivity is not declared as an activity in AndroidManifest.xml

Anyone know why?


回答1:


May you forgot to define Activity in your AndroidManifest.xml

<activity
    android:name="com.facebook.LoginActivity"
    android:label="@string/title_facebook_login" >
</activity>



回答2:


I had the same problem and it was because I forgot to add the com.facebook.LoginActivity activity to AndroidManifest.xml.

Also check that you followed the steps on the "Create a new Android Project with Facebook Login" section on https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/ , specially those regarding adding the app_id string to res/values/strings.xml, the INTERNET permission, the com.facebook.sdk.ApplicationId Meta Data, and finally the mentioned LoginActivity.




回答3:


While the original question is related to SDK 3.0 I think it's worth mentioning that in SDK v4.0.+ the activity that needs to be declared in the AndroidManifest.xml is com.facebook.FacebookActivity eg:

<activity android:name="com.facebook.FacebookActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:label="@string/app_name" />



回答4:


In this link

<activity
    android:name="com.facebook.LoginActivity"
    android:label="title_facebook_login" >
</activity>

is not mentioned.

Add this in AndroidMainfest.xml and problem solved.




回答5:


https://developers.facebook.com/docs/reference/android/3.0/class/LoginActivity/

<activity
    android:name="com.facebook.LoginActivity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>


来源:https://stackoverflow.com/questions/13509113/error-compile-in-use-facebook-login-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!