Unable to open Facebook login screen

162 views Asked by At

I'm trying to create a Facebook login for an app in Android (iPhone working fine).

This is my tiapp.xml (as instructed here: http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook):

 <android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
        <application android:theme="@style/Light">
            <activity android:label="@string/app_name"
                android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
            <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        </application>
    </manifest>
</android>

I've also added the strings.xml resource as needed. But when I try to call the authorize() function I get the following error:

Ucaught Error: Log in attempt failed: FacebookActivity could not be started. Please make sure you added FacebookActivity to the AndroidManifest.

What is missing here?

1

There are 1 answers

0
Hans Knöchel On BEST ANSWER

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

The important thing is to replace com.facebook.LoginActivity with com.facebook.FacebookActivity activity here, Facebook changed that a few versions ago. For more information, check the ti.facebook repository.