Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove LoginActivity from Manifest - Facebook SDK for Android 3.0

I notice that Facebook SDK 3.0 has to have the LoginActivity declaration in Manifest file.

<activity android:name="com.facebook.LoginActivity"
          android:label="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/applicationId" />

If it's not there, the below exception is thrown.

com.facebook.FacebookException: Cannot use SessionLoginBehavior SSO_WITH_FALLBACK when com.facebook.LoginActivity is not declared as an activity in AndroidManifest.xml

It seems a bad practice when Facebook SDK has to depend on this declaration. I wonder if there is a way to remove it from Manifest file.

About the applicationId missing, I can pass it in code by modifying some functions, LoginButton constructor and Session constructor.

like image 920
emeraldhieu Avatar asked Nov 26 '12 06:11

emeraldhieu


2 Answers

When using the official build stack, you need to reference every Activity (that needs to be started) in your manifest. This is indeed counter-intuitive, since one would expect such things to be inherited from included libraries.

A process known as "manifest merging" is right now possible with the Maven build stack and with the new build system. Since the new build system is still work-in-progress, you just have to wait until it is being rolled out officially.

like image 97
Max Hille Avatar answered Oct 13 '22 01:10

Max Hille


As the error suggests put the declaration as follow in your manifest:

<activity android:name="com.facebook.LoginActivity"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"
          android:label="@string/app_name" />
like image 43
Nabin Avatar answered Oct 12 '22 23:10

Nabin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!