androidfacebookunity-game-enginefacebook-unity-sdk

Unity Can't build android with facebook sdk


I have added the Facebook SDK (v7.10.1) to my Unity project, where I have the Gamespark SDK, too.

When I build the game I get a re-package error.

Anyone a idea what's the problem?

CommandInvokationFailure: Failed to re-package resources.
D:\Programmieren\Zubehör\Android SDK\build-tools\25.0.2\aapt.exe package --
auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I 
"D:/Programmieren/Zubehör/Android SDK\platforms\android-26\android.jar" -F 
bin/resources.ap_ --extra-packages com.facebook:com.facebook.android -S 
"E:\Programmieren\C#\workspaces\Ice Slider\Unity3d\Ice 
Slider\Temp\StagingArea\android-libraries\facebook-android-sdk-4.23.0\res" -
S "E:\Programmieren\C#\workspaces\Ice Slider\Unity3d\Ice 
Slider\Temp\StagingArea\android-libraries\facebook-android-wrapper-
7.10.1\res"

stderr[
E:\Programmieren\C#\workspaces\Ice Slider\Unity3d\Ice             
Slider\Temp\StagingArea\android-libraries\facebook-android-sdk-
4.23.0\res\values\values.xml:131: error: Error retrieving parent for item: 
No resource found that matches the given name 
'@style/Theme.AppCompat.NoActionBar'.

E:\Programmieren\C#\workspaces\Ice Slider\Unity3d\Ice 
Slider\Temp\StagingArea\android-libraries\facebook-android-sdk-
4.23.0\res\values\values.xml:136: error: Error retrieving parent for item: 
No resource found that matches the given name 
'@style/Theme.AppCompat.Dialog'.

]
stdout[
Configurations:
 (default)

Files: 
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Solution

  • I got the solution for this problem. Here are few steps to do:

    1. Delete Facebook SDK folder.
    2. Delete PlayServicesResolver folder.
    3. Delete Plugins Folder.
    4. Now comment the code using Facebook API and namespaces.
    5. Now import FacebookSDK 7.10.0 and configure it with project details in Edit-setting option.
    6. Now regenerate Android Manifest file and uncomment the code.

    Now you can successfully build Apk for your project.