问题
I am using Unity 4.1.2 I have downloaded the latest Facebook SDK for Android package for unity from the developer's site. The package file name is "FacebookSDK-140401.unitypackage" The package is: 5.1 , April 1,2014 I created a new empty project. Imported the package. Opened the Example scene that came with the package: "InteractiveConsole" I played the game in my Unity Editor and pressed FB.Init() it worked fine. Here are the screenshots of the game and debug output.
The Facebook Settings are as follows:
you are free to use them and test and revert to this question.
The problem is this works fine in Unity Editor, but when I build the app and transfer it to my android phone(Samsung Galaxy Tab 2) and play it, the screen opens and everything looks okay. when I hit 'FB.Init' button, the game hangs for a while and it crashes to my home screen.
PS: I don't have any Facebook App installed on my phone. Is it necessary?
回答1:
I faced same problem, working fine in unity editor, but not working in android phone. I was using game analytics sdk also, so I got two support-version in my Assets folder:
- 1st one in Assets\Plugins\Android\support-v4-24.2.0
- 2nd one in Assets\FacebookSDK\Plugins\Android\libs\support-v4-23.4.0
As not support more than one support-version, I deleted 2nd one.
For me it was the problem, FB.Init() was not working in phone.
When I delete First one and keep the 2nd one, Its worked!!!
来源:https://stackoverflow.com/questions/23388069/facebook-fb-init-fail-for-android-unity