- Home /
Importing Facebook SDK on project makes the build crash on Android
I have a simple 2D game that I want to use Facebook SDK to allow users to share information on social media. I tried importing the new version of Facebook SDK in the official website, set up the App Id and when I build my project, even if I'm not using anything related to Facebook on my project, the app simply crashes without even opening the Unity Splash Screen.
I tried installing older versions, changing the Android Manifest file and lots of other things but nothing seems to help, does anyone know what may be causing it?
Extra info:
Unity Version: 2019.1.14f1 (in External Tools for Android I'm using JDK, Android SDK, Android NDK, etc installed with Unity)
Tested Facebook SDK versions: 7.17.2, 7.16.1, 7.15.1
Edit: I tried other things suggested in different forums as changing my AndroidManifest.xml file, deleting the FacebookSDK/Plugins/Android/libs directory, different settings in the facebook's developer page but nothing works, no one has any idea of what is causing this?
Answer by LTonon · Oct 16, 2019 at 01:53 AM
Just solved my problem so I'll explain it here in case someone else has the same difficulties.
I was assuming I did something wrong with the Facebook configuration in my Project, but I noticed that even though Facebook said everything was ok, Force Resolving the Play Services showed an error saying Gradle failed to fetch dependencies.
that I did not notice before... Which was caused by my project name having an '!' character, which I assume the GooglePlayServicesResolver can't process correctly.
Changing the project name and force resolving the play services (right-click anywhere in you project folder and then go to Play Services Resolver->Android Resolver-> Force Resolve)
Answer by gladieweb · Oct 13, 2019 at 03:50 AM
can you show the android error log?
Something like this? (sorry, not familiar with android logs, I used adb logcat and searched the exception)
java.lang.RuntimeException: Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: ...
export project on unity build. there is a check box to export, then you can debug on android studio better.
Ok, tried doing so and running the build on Debug, got these errors: link text
I figured, I tried openning it here as well and nothing... Unity's not showing it properly, but if you just use ctrl + s you should be able to download it ^^