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.
TL;DR
- The Facebook SDK for Unity has a recurring "Library not loaded" crash on start, usually fixed by editing
Dependencies.xmlunderFacebookSDK/Editor. - Keep exactly one
facebook-android-wrapperfile underFacebookSDK/Plugins/Android/libs; two versions side by side cause a duplicate library error at compile time. - This is a living reference, updated as new SDK versions surface new issues.
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. 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 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 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.
To be continued...
That is all for now, as we discover more tips and tricks to solve Facebook SDK issues, we will be posting them here. For the underlying setup this all runs on, see Unity development.