Facebook as an extension

Yeah, so both the Facebook extension and the AdMob extension use and include a jar for com.android.support.customtabs. This and the other support libs should probably be moved to a base extension.

@Dragosha can you please share the list of dependencies you have when AdMob and Facebook works together?

2 Likes

My latest app on store builded with this dependencies:
https://github.com/britzl/defold-googleanalytics/archive/master.zip,
https://github.com/PlayFab/LuaSdk/raw/master/Defold/PlayFabClientSdk.zip,
https://github.com/AGulev/defreview/archive/master.zip,
https://github.com/britzl/monarch/archive/2.15.1.zip,
https://github.com/defold/extension-facebook/archive/v1.4.zip,
https://github.com/Lerg/extension-admob/archive/master.zip,
https://github.com/defold/extension-firebase-core/archive/master.zip,
https://github.com/defold/extension-gpgs/archive/master.zip,
https://github.com/defold/extension-gps/archive/master.zip,
https://github.com/defold/extension-iap/archive/master.zip

and also https://github.com/Dragosha/defoldgamecenter as project folder.

1 Like

Which list of dependencies need to build latest release FB extension now?
Iā€™ve tried this as mention in updated docs:

https://github.com/defold/extension-facebook/archive/2.2.7.zip,
https://github.com/defold/android-base-extensions/releases/download/1.0.0/support-v4-27.0.2.zip,
https://github.com/defold/android-base-extensions/releases/download/1.0.0/support-v7-27.0.2.zip

list of all included (removed admob for pure experiment)
https://github.com/britzl/defold-googleanalytics/archive/master.zip,
https://github.com/PlayFab/LuaSdk/raw/master/Defold/PlayFabClientSdk.zip,
https://github.com/AGulev/defreview/archive/master.zip,
https://github.com/britzl/monarch/archive/2.15.1.zip,
https://github.com/defold/extension-gpgs/archive/17.0.0.zip,
https://github.com/defold/extension-iap/archive/1.0.1.zip,

result:

Failed building Android resources to R.java: warning: string 'com_facebook_loginview_logged_in_using_facebook_f1gender' has no default translation.
C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "cardBackgroundColor" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "cardCornerRadius" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "cardElevation" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "cardMaxElevation" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "cardUseCompatPadding" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "cardPreventCornerOverlap" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "contentPadding" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "contentPaddingLeft" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "contentPaddingRight" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "contentPaddingTop" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.cardview-v7-27.0.2\values\values.xml:7: error: Attribute "contentPaddingBottom" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:3: error: Attribute "drawerArrowStyle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:4: error: Attribute "height" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:5: error: Attribute "isLightTheme" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:6: error: Attribute "title" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:71: error: Attribute "navigationMode" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:78: error: Attribute "displayOptions" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "subtitle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "titleTextStyle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "subtitleTextStyle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "icon" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "logo" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "divider" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "background" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "backgroundStacked" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "backgroundSplit" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "customNavigationLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "homeLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "progressBarStyle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "indeterminateProgressStyle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "progressBarPadding" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "itemPadding" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "hideOnContentScroll" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "contentInsetStart" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "contentInsetEnd" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "contentInsetLeft" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "contentInsetRight" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "contentInsetStartWithNavigation" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "contentInsetEndWithActions" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "elevation" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:86: error: Attribute "popupTheme" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:90: error: Attribute "closeItemLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:91: error: Attribute "initialActivityCount" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:91: error: Attribute "expandActivityOverflowButtonDrawable" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:92: error: Attribute "buttonPanelSideLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:92: error: Attribute "listLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:92: error: Attribute "multiChoiceItemLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:92: error: Attribute "singleChoiceItemLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:92: error: Attribute "listItemLayout" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:92: error: Attribute "showTitle" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:93: error: Attribute "srcCompat" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:93: error: Attribute "tint" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:93: error: Attribute "tintMode" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:107: error: Attribute "tickMark" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:107: error: Attribute "tickMarkTint" has already been defined

C:\Users\isunt\AppData\Local\Temp\bob_bundle_tmp1590016241240099912\extensions\facebook\com.android.support.appcompat-v7-27.0.2\values\values.xml:107: error: Attribute "tickMarkTintMode" has already been defined

....
removed for post size resone

Latest version is 2.3.1. It depends on:

I will make a separate post later today about changes to the Android base extension dependencies to bring some clarity. Sorry for the temporary confusion.

2 Likes

it works!

2 Likes

Build error when tried to make iOS bundle:

Ah, thatā€™s because the 2.3.x version needs the 1.2.164 server.
Weā€™re scheduled to release a new version today, in the mean time, you can use https://build-stage.defold.com

You need both the new version and the new server, weā€™re working on itā€¦

1 Like

Will purchase events be posted to FB analytics automatically?
Referring to this https://developers.facebook.com/docs/analytics/send_data/events:

So, if Iā€™ve kept this checkbox, will the purchase be logged automatically by the FB extension?

Ok, I see IAP events in FB Analytics dashboard, so it works (and I did not send these events manually).
But I see 2 events, when there was only one purchase (and it was restored more than 2 times). :man_shrugging:

Hi. I see the 6.3.0 version of android facebook SDK was released recently:

And, Iā€™m not 100% sure, but it seems supporting AndroidX now (at least I see in commits some related stuff, and switching to 28 version of android SDK as well).

Is it possible to update the extension?

Iā€™ve tried to update android part by my own, updated dependency in build.gradle, fixed references in code from old support libs to new androidx libs, but stuck with susch error message:

Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from AndroidManifest.xml:24:18-86 is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).

Possible solution Iā€™ve googled is setting these lines in gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

But I donā€™t see a way to modify properteis files and donā€™t know if it already set so.

Weā€™re still using Android 28, and updating is ofc on our roadmap, but itā€™s in there with other features.
It usually requires a lot of testing, and also upgrading a lot of extensions to make sure they still work.

Let me remind you that weā€™re not actually using gradle to build Android, we merely use it to resolve packages, to avoid the manual unpacking and conflict resolution. Therefore itā€™s not as simple as setting a property in your gradle file.

As for always chasing the latest version of every package, let me tell you itā€™s a very big timesink, and often with pitfalls. Thatā€™s also one of the reasons we tend to delay updates a bit.

As for the feature, whatā€™s the use case? What feature in that facebook upgrade do you wish to use?

1 Like

Iā€™m forced to switch to AndroidX ā€œwayā€ by other extensions - Admob, Firebase, IronSource. All this can work on old versions, if you made extensions at the same time somewhere in the past, when AndroidX was not pushed by Google. But for example for IronSource itā€™s not an option, I canā€™t use old version of IS and ad network adapters and SDKs. And this affects all other extensions, which do not support AndroidX. In my case only Facebook SDK is the problem. Everything else is up to date.

BUT, just because the Facebook extension uses old support libs, it brokes all other extensions, which already migrated to AndroidX way. So I either should throw away Facebook SDK (what means no FB ads for UA, as tracking will not work), or throw away Admob and Firebase (what means no Google Ads both for monetization and UA).

Right now Iā€™m using old Firebase extension version for Android build, it works with old FB extension, but I canā€™t add Admob; and using up-to-date Firebase for iOS, because the old one conflicts with Admob on iOS. This setup is already complicated and I was waiting for official support of AndroidX from Facebook, now itā€™s live and I want to use all the libs up to date and synced.

3 Likes

Iā€™m still trying to update the FB extension and prepared a branch just to illustrate the issue Iā€™m stuck with.

Here is a dev branch in forked repo from original defold facebook-extension: https://github.com/MaratGilyazov/extension-facebook/tree/update_6.3.0/android

I did just few changes: https://github.com/MaratGilyazov/extension-facebook/commit/997d9e26908cfaef90cfc6baffa08b21683fcd68

  1. First of all - switched dependencies to a new 6.3.0 SDK (now there is only one dependency required). If keep just this chane - extension itself can be build without any issues.

  2. But in a real project I also need Admob, so Iā€™ve also added a dependency for Admob just to illustrate the conflict - now it fails with the message, Iā€™ve mentioned in previous messages:

Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from AndroidManifest.xml:24:18-86 is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).

Thats the main issue I canā€™t solve by my own :frowning:

  1. I see there is a dependency for android.support.v4.app.FragmentActivity - I believe as long as FB switched to AndroidX there should be no refs to ā€œoldā€ support libs.
    When I run ā€œMigrate to AndroidXā€ command from Android Studio it changes this import directive to androidx.core.app.FragmentActivity + asks me to add gradle.properties file with lines mentioned above:

android.enableJetifier=true
android.useAndroidX=true

But when I try to build from such state, it fails with such error:


And anyway, this class seems to be not used here at all, so Iā€™ve simply commented it out, but this thing is minor, as build fails on step (2).

Any ideas what Iā€™m doing wrong and how to fix the issue?

BTW, if I use only dependency to Admob itself, without facebook, it builds normally (in my ironsource extension, for ex), so build fails only in combination of FB extension and other up-to-date plugins like Admob or Firebase

Donā€™t you just love how messy Android development can be sometimes :slight_smile:

Important to keep in mind is that we use Gradle only to resolve project dependencies. The android.useAndroidX=true setting will be ignored.

The problem as I see it is that Facebook 6.3.0 still uses android.support.v4.app:

https://mvnrepository.com/artifact/com.facebook.android/facebook-common/6.3.0

2 Likes

Also, I found an interesting discussion in FB rep (especially last 2 comments): https://github.com/facebook/facebook-android-sdk/pull/689

2 Likes

So actually they did not switch to AndroidX yet :sob: ā€¦

I saw that this PR named ā€œUpdate to AndroidXā€ was not merged, but also there was something said about ā€œthis will be supported internallyā€ and at first I thought this commit covered what needed:

But obviously it just switches version of used support libs, and itā€™s not about mirgation to AndroidX.

Ok, Iā€™ll be waiting for further updates in FB repo.
Thanks for checking and sorry for disturbing on Saturday :slight_smile:

1 Like

And this Jetifier tool seems to be used for such migration ā€œmanuallyā€ somehow, but I donā€™t think itā€™s a right way to even give it a try: https://developer.android.com/studio/command-line/jetifier

1 Like

We have updated the Facebook extension to use Facebook SDK 6.5.1 for Android and iOS:

This is the last release on the 6.x branch of SDKs and the last SDK release which uses the old version of Android Support libraries. AndroidX is included in versions starting from 7.0.0 of the Facebook SDK for Android.

NOTE: We will not yet make this update to AndroidX as we also need to modify the build system to use the jetifier tool to automatically upgrade extensions to use AndroidX.

2 Likes

This Facebook blog post states that the version of the SDK used by extension-facebook (9.0.1) will be ā€˜sunsettedā€™ on June 8, 2023 this year - not just deprecated but apparently will no longer be operational.

I wasnā€™t able to find any further announcements, but v11 will suffer the same fate in October, and v12 and v13 are already deprecated.

v12 introduces a minimum requirement of iOS 10.0 (previously 9.0), v13 requires iOS 11.0 and v15 requires v12.0

Iā€™m tempted to try an upgrade (although if it was too challenging I wouldnā€™t be able to spend much time on it) - any thoughts on which version? Personally Iā€™d likely go for 14.1.0 which is the latest before the v15 upgrade requiring iOS 12.0. The latest v12 (12.3.2) is tempting but is already halfway through its 2-year deprecation period.

I would suggest that we try with v14.1.0, especially now that we also have Cocoapod support which means that we can get rid of the iOS frameworks. For iOS add a Podfile in manifests/ios, something like this one:

platform :ios, '11.0'
pod 'FBSDKCoreKit', '14.1.0'
pod 'FBSDKLoginKit' '14.1.0'
pod 'FBSDKShareKit' '14.1.0'
1 Like