42

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?

Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96
Pootree Kun
  • 421
  • 1
  • 4
  • 3
  • Show us some code, it's difficult to tell it just by the error message. – Chris Hasiński Nov 22 '12 at 09:29
  • I have my login button as my main activity, and I was going to make it disappear after login. Does Login HAVE to be it's own activity? –  Jan 30 '15 at 03:00

5 Answers5

76

May you forgot to define Activity in your AndroidManifest.xml

<activity
    android:name="com.facebook.LoginActivity"
    android:label="@string/title_facebook_login" >
</activity>
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
  • as this might not be the launcher activity then what can we do in this case? – Nitesh Verma Aug 12 '14 at 04:36
  • I am assuming that this is an activity that exists in the Facebook SDK that will included in my apk file. Or, is it a reference to an activity in the Facebook app required to already be installed on the device? – reubenjohn Jan 23 '15 at 09:48
64

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.

Enrique Alcor
  • 641
  • 4
  • 6
12

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" />
karel.herink
  • 927
  • 9
  • 10
3

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.

Arshad Ali
  • 3,082
  • 12
  • 56
  • 99
Keyul
  • 729
  • 1
  • 8
  • 20
0

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>
Sazid
  • 2,747
  • 1
  • 22
  • 34