简体   繁体   中英

Appcelerator Android Facebook Login Problems

I'm trying to let app users log into my Appcelerator app via Facebook. The Facebook app is in place. The correct hashes should also be in the Facebook dev system. The iOS login works perfect. Android however, gives this error:

[DEBUG] :  TiFacebookModule: (KrollRuntimeThread) [7865,569655] authorize called, permissions length: 1
[DEBUG] :  TiFacebookModule: (KrollRuntimeThread) [0,569655] authorizing permission: email
[DEBUG] :  ActivityWorkerProxy: (main) [232,569887] ActivityWorkerProxy onActivityResult
[ERROR] :  TiFacebookModule: (main) [1,569888] FacebookCallback error: Login attempt failed.
[ERROR] :  E/        : UID 10070 asks for /proc/cpuinfo
[ERROR] :  E/        : Unable to open file /data/data/.appwithABI2
[ERROR] :  E/        : Unable to open file /data/data/.appwithABI2neon
[ERROR] :  E/        : UID 10070 is not in ARM UID list files

tiapp.xml:

## SDK: 6.0.1GA
## facebook module included (android 6.2.0)

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-permission android:name="android.permission.INTERNET"/>
        <application>
            <activity android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="myNewApp"
            android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
            <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
            <activity android:name="com.mynewapp.android" />
            <resources>
                <string name="facebook_app_id">[actual_FB_ID#]</string>
            </resources>
        </application>
        <resources>
            <string name="facebook_app_id">[actual_FB_ID#]</string>
        </resources>
    </manifest>
    <resources>
        <string name="facebook_app_id">[actual_FB_ID#]</string>
    </resources>
</android>

The app_id is an actual, valid, real app ID#. I have it in multiple places just to make sure the app can see it properly.

strings.xml: (COMPLETE FILE)

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="app_name" formatted="false">[Tried both the Facebook "Display Name" & the "Namespace"]</string>
    <string name="facebook_app_id">[actual_FB_ID#]</string>
</resources>

Facebook APP / Settings:

App ID: [actual_FB_ID#]
App Secret: ******
Display Name: A Display Name
Namespace: anamespace
App Domains: [EMPTY]
Privacy: [EMPTY]
Terms: [EMPTY]
Category: Health & Fitness

// ANDROID
Google Play Package Name: [see below]
Class Name: [package name above + .index]
Key Hashes: [4: 6.0.0.GA, 6.0.1.GA, 6.0.2.GA, and 6.0.3.GA] 
Amazon App Store: [EMPTY]
Single Sign On: No

There is no Google play package name since it's not published yet. I used the App id from tiapp.xml

Facebook Products / Facebook Login / Settings:

Client OAuth Login: Yes
Web OAuth Login: Yes
Force Web OAuth Reauthentication: No
Embedded Browser OAuth Login: No
Valid Redirects: [EMPTY]
Login From Devices: Yes

Facebook Developer Settings // Sample App Settings:

Entering key hashes here doesn't save. I enter the same hashes as in the android settings above, hit "Save Changes", and they just disappear.

alloy.js:

Alloy.Globals.Facebook = require('facebook');
var fb = require('facebook');

index.js:

$.index.fbProxy = fb.createActivityWorker({
    lifecycleContainer: $.index
});

fb.initialize();
fb.setLoginBehavior(fb.LOGIN_BEHAVIOR_NATIVE);
fb.permissions = ['email'];
fb.addEventListener('login', doFBlogin);

function facebookButtonClick(e){
    fb.authorize();
}

function doFBlogin(e) {
    if (e.success) {
        alert("Success!");
    } else if (e.cancelled) {
        alert("Cancelled!");
    } else {
        alert("Error!");
    }
}

I've tried everything I can think of to fix this. Any assistance would be greatly appreciated. Thanks.

Did you add the Facebook App ID to Android Resources? What is your facebook module version? You can try different version

Hope this helps.

Add a string element to the /platform/android/res/values/strings.xml file with the name attribute set to facebook_app_id and the node text set to your Facebook App ID.

<resources>
    <string name="facebook_app_id">FACEBOOK_APP_ID</string>
</resources>

Since Facebook module v4.0.0, for the Android platform, you need to:

Add the Facebook Login activity to the Android manifest Add the

Facebook App ID to the Android resources string.xml file Create a

Facebook proxy and associate it with the currently active activity

Seems you did not complete additional android setup steps. For details please take a look on documents: http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM