Unity Can't build android with facebook sdk

≡放荡痞女 提交于 2020-01-05 08:10: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

回答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.




回答2:


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.




回答3:


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




回答4:


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




回答5:


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.


来源:https://stackoverflow.com/questions/48275051/unity-cant-build-android-with-facebook-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!