Facebook-sdk-for-unity: Crash on importing SDK (Unity 2019.3.0f3)

Created on 5 Jan 2020  ·  4Comments  ·  Source: facebook/facebook-sdk-for-unity

Importing the Facebook SDK 7.18.0 (downloaded from the official website) into an empty Unity 2019.3.0f3 project causes it to crash with the following error:

ArgumentException: Requested value 'X86' was not found.
System.Enum+EnumResult.SetFailure (System.Enum+ParseFailureKind failure, System.String failureMessageID, System.Object failureMessageFormatArgument) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Enum.TryParseEnum (System.Type enumType, System.String value, System.Boolean ignoreCase, System.Enum+EnumResult& parseResult) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Enum.Parse (System.Type enumType, System.String value, System.Boolean ignoreCase) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Enum.Parse (System.Type enumType, System.String value) (at <437ba245d8404784b9fbab9b439ac908>:0)
GooglePlayServices.AndroidAbis.EnumValueStringToULong (System.Type enumType, System.String enumValueString) (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/AndroidAbis.cs:182)
GooglePlayServices.AndroidAbis.get_Current () (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/AndroidAbis.cs:241)
GooglePlayServices.PlayServicesResolver.PollAndroidAbis () (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1126)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Delegate.DynamicInvoke (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:310)

It also crashes whenever you try to open the project, and regardless of whether you try to update the outdated APIs or not.

Is there a fix for this?

Most helpful comment

Thanks @rahil-p, that fixed the crashing! But when I try to build the provided MainMenu scene, it gives this error:

Error building Player: Component GUI Layer in Main Camera for Scene Assets/FacebookSDK/Examples/MainMenu.unity is no longer available.
It will be removed after you edit this GameObject and save the Scene.

Any pointers?

All 4 comments

It's not clear whether the SDK is still being updated. Are you on Windows or Mac?

OS X 10.15.1.

That's unfortunate... Are there any alternatives other than the REST API?

@michelleran I believe the problem stems from the PlayServicesResolver subdirectory; Facebook Unity SDK v7.18 currently uses Play Services Resolver v1.2.95 (commit https://github.com/facebook/facebook-sdk-for-unity/commit/17849bc0d9352a82538ffc72b73e7d490953aeff). Upgrading the resolver to v1.2.116+ should solve the issue.

This should work for you, hopefully:

  1. Delete the PlayServicesResolver folder that was imported with the Facebook Unity SDK.
  2. Download a recent Play Services Resolver package (e.g. v1.2.135) and import into your project.

Thanks @rahil-p, that fixed the crashing! But when I try to build the provided MainMenu scene, it gives this error:

Error building Player: Component GUI Layer in Main Camera for Scene Assets/FacebookSDK/Examples/MainMenu.unity is no longer available.
It will be removed after you edit this GameObject and save the Scene.

Any pointers?

Was this page helpful?
0 / 5 - 0 ratings