Max
Max

Reputation: 220

cordova-plugin-facebook4 Couldn't Make The App Start (Android)

I have an existing app which this plugin runs fine, but today it decides to fail on me.

I can be certain that the below will very likely to re-produce the issue, once the plugin was installed, the app resulted to a blank screen after running "cordova run android". Terminal showed "LAUNCHED SUCCESS", no errors/stack trace.

Versions:

To reproduce this:

  1. Fresh install of Android Studio and cordova, accept all licenses from Android e.g. sdkmanager --licenses. Make sure that app is registered in developers.facebook.com with get a proper APP_ID.
  2. Terminal: cordova create appy222 appy222.com appy222
  3. cd into the appy222
  4. cordova plugin add cordova-plugin-facebook4 --variable APP_ID="whateverid" --variable APP_NAME="Appy222"
  5. Insert the xml fragment to cordova-plugin-facebook4's plugin.xml <config-file parent="/resources" target="./res/values/strings.xml"> <string name="fb_app_id">$APP_ID</string> <string name="fb_app_name">$APP_NAME</string> </config-file>
  6. Change the "android-minSdkVersion" to 16. The original was 15, it complained Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library... when doing cordova run android
  7. cordova platform add android this will install [email protected]
  8. Run by hooking up to the Android mobile phone with develop options enabled. Terminal: cordova run android

And the result was a blank screen...black. The app will run fine without cordova-plugin-facebook4.

Wonder if anybody came across this problem? Hope that someone could share some thoughts here.

Upvotes: 1

Views: 2261

Answers (5)

SmartMan21Cen
SmartMan21Cen

Reputation: 76

Android build.gradle couldn't found $FACEBOOK_ANDROID_SDK_VERSION. So I changed it in ionic-cordova-facebook4 plugin. You can find root/plugins/cordova-plugin-facebook4/plugin.xml file.

Here you can find this setting

please change it to

finally ionic cordova platform rm android, ionic cordova platform add android ionic cordova run android Now All is ok!

Upvotes: 1

user3785966
user3785966

Reputation: 2980

You need to downgrade Facebook Android SDK version to 4.26.0

ionic cordova plugin add cordova-plugin-facebook4 --variable APP_ID="app_id" --variable APP_NAME="app_name" --variable FACEBOOK_ANDROID_SDK_VERSION="4.26.0" --variable ANDROID_SDK_VERSION="4.26.0"

Remember to set both the variables ANDROID_SDK_VERSION & FACEBOOK_ANDROID_SDK_VERSION to avoid conflicts as some of the versions of cordova-plugin-facebook4 was referring to variable ANDROID_SDK_VERSION

Remember to remove and add android platform again.

Upvotes: 0

Max
Max

Reputation: 220

Posting an answer to my own question/problem. Seems that I need to down the Facebook's Android SDK version all the way to just 4.28.0 (instead of 4.36.0 which is the current at the moment of writing).

cordova plugin add cordova-plugin-facebook4 --variable APP_ID="whateverid" --variable APP_NAME="whateverappname" --variable ANDROID_SDK_VERSION="4.28.0"

Upvotes: 0

davyww
davyww

Reputation: 121

Had the same problem. What worked for me was removing the plugin, setting the facebook android sdk version to 4.35.0:

cordova plugin add cordova-plugin-facebook4 --variable APP_ID="whateverid" --variable APP_NAME="Appy222" --variable ANDROID_SDK_VERSION="4.35.0"

Then removing and readding the android platform:

cordova platform rm android

cordova platform add android

Upvotes: 1

BloodKnight
BloodKnight

Reputation: 9

Me too. I got the solution.It must be same name Google Play Package Name in dev facebook app and wiget id in config.xml.

Upvotes: -1

Related Questions