Getting native Facebook Login to work


#1

Hi!

Recently I tried to add native Facebook login capability to my Ionic app for Android, but with no luck.

I tried several cordova facebook plugins, none worked.

Tried the official Wizcorp and Phonegap facebook plugin as mentioned on ngCordova’s page but got all kinds of build errors.

The ngCordova page itself contains several errors which required many hours to resolve:

  • the folder name for the plugin is different from “com.phonegap.plugins.facebookconnect/FacebookLib”

  • I had to copy the local.properties file manually from platforms/android to the plugin folder for ‘ant clean’ to work

  • I also had to manually create the ant-build folder for the second ‘ant clean’ under the plugin folder.

  • The official plugin’s docs also mention fewer steps, and the ngCordova page mentions API levels of 14 and 17 which are quite outdated and it adds to the confusion.

In the end for ionic build android I receive this error:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

The plugin I got the furthest with was cordova-plugin-facebook4, the build succeeded, but after launching the app it quit unexpectedly.

I have to resolve to the less optimal browser login on mobile for now, but would be great if ngCordova could offer a tested and working solution and example for this very basic use case.

Csaba