Error compile in “Use Facebook Login example”

心已入冬 提交于 2019-12-02 21:40:21

May you forgot to define Activity in your AndroidManifest.xml

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

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.

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" />
Keyul

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.

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