Unity Can't build android with facebook sdk

2019-08-09 02:15发布

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

5条回答
Ridiculous、
2楼-- · 2019-08-09 02:35

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

查看更多
闹够了就滚
3楼-- · 2019-08-09 02:35

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.

查看更多
Bombasti
4楼-- · 2019-08-09 02:45

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.
查看更多
Lonely孤独者°
5楼-- · 2019-08-09 02:49

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

查看更多
仙女界的扛把子
6楼-- · 2019-08-09 03:00

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.

查看更多
登录 后发表回答