Fix Common Unity Facebook SDK Issues

Fixes for the Facebook SDK for Unity's most common Android and iOS integration errors, updated as new ones show up.

Unity and Facebook SDK connection points showing login, permission, and build errors alongside the fixes for each

TL;DR

  • The Facebook SDK for Unity has a recurring "Library not loaded" crash on start, usually fixed by editing Dependencies.xml under FacebookSDK/Editor.
  • Keep exactly one facebook-android-wrapper file under FacebookSDK/Plugins/Android/libs; two versions side by side cause a duplicate library error at compile time.
  • I update this page as new SDK versions surface new issues.

Solve Xcode Facebook Errors

I keep running into the same handful of Facebook SDK for Unity problems across projects, usually right after a client asks for Facebook login or sharing on a build that's otherwise finished. Meta's QA on the Unity SDK is inconsistent between releases, so I'm keeping this page updated as new issues turn up. If you're also fighting Gradle on the Android side, see How to Solve Unity Android Gradle Build Issues.

Download Unity Facebook SDK

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

The official Facebook developer page still lists 18.0.0 as the current release, but GitHub has 18.1.0.

That mismatch is part of the problem. Meta's Unity documentation can lag behind the repository, and the SDK often feels like it gets attention only when something breaks loudly enough. Check the GitHub releases page before assuming the official page is current, especially if you're debugging a version-specific Android or iOS issue.

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 for Android.

Delete the older wrapper (e.g. 16.0.2), and keep the newer wrapper (e.g. 17.0.1). Both versions can end up installed side by side if you drag a newer SDK in without removing the old one first.

If you're mid-upgrade and hit something not covered here, get in touch and we'll help track it down.

To be continued...

That is all for now, I'll keep adding to this as new SDK versions surface new issues. This kind of platform-integration work comes up constantly on our game development projects, and it sits on the same Unity development foundation as everything else we build.

Frequently Asked Questions

What is the current Facebook SDK for Unity version?

Facebook's own developer changelog still lists 18.0.0, while GitHub lists 18.1.0 as the latest release. That gap is exactly why you should check GitHub before trusting the official documentation during a Unity SDK upgrade.

Why does my Unity app crash with a Library not loaded FBAEMKit error?

This is almost always a missing dependency declaration in Dependencies.xml under FacebookSDK/Editor. Adding addToAllTargets to each iOS pod entry and rebuilding fixes it.

Why do I get a duplicate library error compiling for Android?

Two versions of facebook-android-wrapper are sitting side by side in FacebookSDK/Plugins/Android/libs, usually left over from dragging a newer SDK in without removing the old one. Delete the older version and keep only the current one.

Where should I download the Facebook SDK for Unity?

Use Facebook's own developer site first, then check the GitHub releases page too. GitHub is often ahead of the official download by a version or more.

Want To Integrate Facebook Into Unity?

Contact Us