Unity Can't build android with facebook sdk
Asked Answered
P

5

1

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
Portfire answered 16/1, 2018 at 6:10 Comment(0)
S
1

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.

Sedlik answered 20/4, 2018 at 8:22 Comment(0)
S
1

The appcompat package is missing from the unity project. Latest Facebook SDKs (7.10, 7.11) don't include all needed Android support libraries.

Make sure you have installed Android Studio and from within Android Studio the necessary support libraries for your project's target SDK version. Copy the needed AAR packages from extras/android/m2repository/com/android/support under the Android SDK folder (~/Library/Android/SDK on mac) to the Plugins/Android/libs folder in the Unity project. The AAR files are somewhere under the folder with the name of the package, appcompat-v7 in this case. There may be several subfolders in this folder. Find the AAR from the subfolder that matches the version you want.

Many plugins and SDKs import copies of these system libraries. Which is not optimal since only one version may be present at a time. So it's left to us to manage these Android support libraries in projects that contain multiple SDKs that depend on them.

Straightjacket answered 14/3, 2018 at 21:24 Comment(0)
S
1

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.

Sedlik answered 20/4, 2018 at 8:22 Comment(0)
S
0

Are you using another plugins ?

Please try as follows:

  • Try to update lastest android sdk and build tools

  • If it wont work,revert back to old android sdk versions

  • Delete whole fb sdk and import it again

Siskin answered 16/1, 2018 at 21:22 Comment(0)
S
0

this happen to me & i try deference way best solution is change sdk to -> facebook-unity-sdk-7.9.4

Shelburne answered 2/3, 2018 at 9:43 Comment(0)
J
-1

This error can be cause due to many things

  1. Update JDK
  2. Check Java Path.
  3. Update Android SDK
  4. Delete duplicate .jar file in unity asset folder under plugins folder.
  5. Check target version in AndroidManifest.xml and Player Settings which should be same.
  6. If these doesn’t work. Your error is causing “Android-26”. So go to androidskd > build-tools and remove the folder android-26 folder and build again.
Jato answered 1/4, 2018 at 9:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.