I’m currently having a ton of issues connecting to Facebook through Android using their new SDK version. We’ve recently updated from the previous one to be able to do WebGL builds, but now the Android builds are completely broken.
FB.Init does not properly initializes the SDK, even though I’ve assured that all of the values from Facebook settings are the same as the ones in my app settings page.
FB.IsInitialized is still false after init. I tried verifying if it was still possible to do anything, but calling FB.ActivateApp would just crash the game, and trying to Login (with either Read or Publish permissions) would freeze the screen.
Anyone had anything similar going on or suggests any possible fix for this?
EDIT: Additional info:
Tested on both a OnePlus One and a Nexus 7, latest android version installed on both. Tried unninstalling the Facebook app as well to see if it affected anything, but no changes.
At the end, I’m crashing the game because I call FB.ActivateApp even though it doesn’t initialize.
This one also happens at the end of initialization: I/Unity (10741): AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/FacebookActivity;
It looks like you’re missing the com.facebook.FacebookActivity class from your game.
Are you sure it is included? i am not sure how it is delivered in 7.1.0, is there a .JAR or .AAR file that is included with the SDK ?
Can you list what you have in your Assets/Plugins/Android folder to see what it contains ?
You can cd into Plugins/Android from a command prompt (on windows) and then hit dir /w > File.txt
This will save a file with all contents of your folder. Then share it on pastebin as well.
…plus bolts and other libraries in there. I have some other duplicated libraries from Google Play services that come from the different plugins that I’m using, but I’ve made sure to disable all of them when compiling.
I’ve just opened the first .aar with WinRAR and checked the jar inside and com.facebook.FacebookActivity is at least in there. Could it maybe be something about Java not compiling things properly? I’m currently using jdk1.7.0_75
Additionally, I’ve seen that FB.Init wrongly sets the Initialized boolean only after it calls the callback, but changing it didn’t make any difference.
the last thing i can think of is that the Activity (or activities) for Facebook are not declared in your AndroidManifest.xml
This manifest is generated (or patched, if it’s already there) after you open the Facebook settings dialog (Top “Facebook” menu → Edit Settings). There’s a button there “Regenerate Android Manifest” that should prep up your AndroidManifest file with all the needed activities.
Did you perform that step ? do you have a valid AndroidManifest.xml under Plugins/Android ?
Everything was solved on the 13th when Facebook released the new version of their SDK. I simply got rid of all references that I had from the previous version and added the new one. I had no problems with Android since then, so I imagine that whatever issue I had, it was solved with their latest release.