[英]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.我已将 Facebook SDK (v7.10.1) 添加到我的 Unity 项目中,其中我也有 Gamespark SDK。
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
The appcompat package is missing from the unity project.统一项目中缺少 appcompat 包。 Latest Facebook SDKs (7.10, 7.11) don't include all needed Android support libraries.
最新的 Facebook SDK(7.10、7.11)不包括所有需要的 Android 支持库。
Make sure you have installed Android Studio and from within Android Studio the necessary support libraries for your project's target SDK version.确保您已安装 Android Studio 并在 Android Studio 中为您的项目的目标 SDK 版本安装了必要的支持库。 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.将所需的 AAR 包从 Android SDK 文件夹(Mac 上为
~/Library/Android/SDK
)下的extras/android/m2repository/com/android/support
复制到 Unity 项目的Plugins/Android/libs
文件夹中。 The AAR files are somewhere under the folder with the name of the package, appcompat-v7 in this case. AAR 文件位于具有包名称的文件夹下,在本例中为 appcompat-v7。 There may be several subfolders in this folder.
此文件夹中可能有多个子文件夹。 Find the AAR from the subfolder that matches the version you want.
从与您想要的版本匹配的子文件夹中找到 AAR。
Many plugins and SDKs import copies of these system libraries.许多插件和 SDK 会导入这些系统库的副本。 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.
因此,我们需要在包含多个依赖于它们的 SDK 的项目中管理这些 Android 支持库。
I got the solution for this problem.我得到了这个问题的解决方案。 Here are few steps to do:
这里有几个步骤:
Now you can successfully build Apk for your project.现在您可以为您的项目成功构建 Apk。
Are you using another plugins ?您在使用其他插件吗?
Please try as follows:请尝试如下:
Try to update lastest android sdk and build tools尝试更新最新的 android sdk 和构建工具
If it wont work,revert back to old android sdk versions如果它不起作用,请恢复到旧的 android sdk 版本
Delete whole fb sdk and import it again删除整个 fb sdk 并再次导入
这发生在我身上,我尝试尊重方式最好的解决方案是将 sdk 更改为 -> facebook-unity-sdk-7.9.4
This error can be cause due to many things这个错误可能是由于很多事情造成的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.