0
votes

after installing the cordova plugin facebook using the commands:

sudo cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="xxx" --variable APP_NAME="xxx" and the

sudo npm install @ionic-native/facebook

and after adding the Android platform 7.1.1 when I run the app crashes immediately after the splash screen with no logs.

If I open Android Studio from the errors log I can read the following error:

Caused by: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.

I attached the ionic info:

Ionic:

ionic (Ionic CLI) : 4.1.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.1.1 ([email protected]) Cordova Platforms : android 7.1.4 Cordova Plugins : no whitelisted plugins (25 plugins total)

System:

ios-deploy : 1.9.4 NodeJS : v8.11.1 (/usr/local/bin/node)
npm : 6.4.1 OS : macOS Xcode : Xcode 10.2 Build version 10E125

Thanks in advance.

1

1 Answers

0
votes

I solved it by myself.

I modify the AndroidManifest insert this 3 lines of code

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id" />
        <meta-data android:name="com.facebook.sdk.ApplicationName" android:value="@string/fb_app_name" />
        <activity android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/fb_app_name" android:name="com.facebook.FacebookActivity" />

I don't know why the lines are not added automatically.