1
votes

I cannot build Facebook SDK (7.10.1) in an empty Unity (5.6.2f1) project.

Error:

CommandInvokationFailure: Failed to re-package resources. C:\Users\Michal\AppData\Local\Android\sdk\build-tools\27.0.2\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "C:/Users/Michal/AppData/Local/Android/sdk\platforms\android- 25\android.jar" -F bin/resources.ap_ --extra-packages com.facebook:com.facebook.android -S "C:\Users\Michal\Documents\Unity Projects\FacebookFuck\Temp\StagingArea\android-libraries\facebook-android- sdk-4.23.0\res" -S "C:\Users\Michal\Documents\Unity Projects\FacebookFuck\Temp\StagingArea\android-libraries\facebook-android-wrapper-7.10.1\res"

4
And I have my Android SDK Studio updated to the latest version.Michal Krča

4 Answers

1
votes

It worked for me to delete the duplicate packages.

The default Android package in my Unity (2019.3.0a12) contains redundant classes to the Facebook SDK (7.17.2). Unity will replace any deleted Android packages with the manifest.xml so you have to remove the duplicate classes from the FB SDK.

In Unity I deleted the entire directory at Assets/FacebookSDK/Plugins/Android/lib and my build succeeded.

0
votes

I had a similar issue. The problem was that my Java was on the latest version on my PC. This doesn't work well with Unity.The last version stable with unity is JDK 1.8. Please uninstall your current JDK and JRE and install version 1.8.

0
votes

Change build type to "Gradle" if it is internal. Just remove "libs" folder under Plugins -> Android. It worked for me like charm.

0
votes

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-25”. So go to androidskd > build-tools and remove the folder android-25 folder and build again.