Blog

Fix Common Unity Facebook SDK Issues

The Facebook SDK for Unity is known to present recurring integration and compatibility issues, often stemming from limited QA and delayed updates from Meta.

Unity Facebook Apple

Jacques Leemans · Android, Debug, Facebook SDK, Gradle, Troubleshooting, Unity, XCode · September 14, 2024

Solve XCode Facebook Errors

The Facebook SDK for Unity is known to present recurring integration and compatibility issues, often stemming from limited QA and delayed updates from Meta. This post serves as a continuously updated technical reference for identifying, debugging, and resolving common Facebook SDK issues in Unity projects.

Download Unity Facebook SDK

The Facebook SDK for Unity can be downloaded from the Facebook developer website.

The current release version is 18.0.0.

The official Facebook developer website can lag behind, so also check the GitHub releases page for newer versions, e.g. 18.1.0.

Library not loaded or no such file

This issue normally doesn’t cause any compiler or linker issues, instead, the app would crash on start, and display some error like below:

Library not loaded: @rpath/FBAEMKit.framework/FBAEMKit
 FBAEMKit.framework/FBAEMKit' (no such file)

To solve this issue, open the Dependencies.xml located at FacebookSDK/Editor.

The file should look something like below:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-login:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-share:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-gamingservices:[17.0.0,18)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit_Basics" version="~> 17.0.1" />
        <iosPod name="FBSDKCoreKit" version="~> 17.0.1" />
        <iosPod name="FBSDKLoginKit" version="~> 17.0.1" />
        <iosPod name="FBSDKShareKit" version="~> 17.0.1" />
        <iosPod name="FBSDKGamingServicesKit" version="~> 17.0.1" />
    </iosPods>
</dependencies>
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-login:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-share:[17.0.0,18)" />
        <androidPackage spec="com.facebook.android:facebook-gamingservices:[17.0.0,18)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit_Basics" version="~> 17.0.1" addToAllTargets="true"/>
        <iosPod name="FBSDKCoreKit" version="~> 17.0.1" addToAllTargets="true"/>
        <iosPod name="FBSDKLoginKit" version="~> 17.0.1" addToAllTargets="true"/>
        <iosPod name="FBSDKShareKit" version="~> 17.0.1" addToAllTargets="true"/>
        <iosPod name="FBSDKGamingServicesKit" version="~> 17.0.1" addToAllTargets="true"/>
    </iosPods>
</dependencies>

Upgrading the Unity Facebook SDK

When you upgrade the Facebook Unity SDK, there are a few things to keep in mind:

For Android, check the following folder:

FacebookSDK/Plugins/Android/libs

Make sure there is only 1 facebook-android-wrapper file, to avoid getting a duplicate library error when compiling to Android

Delete the older wrapper (16.0.2 in the screenshot above), and keep the newer wrapper (17.0.1)

To be continued...

That is all for now, as we discover more tips and tricks to solve Facebook SDK issue, we will be posting them here.

What To Integrate Facebook Into Unity?

Contact Us