CommandInvokationFailure when building for Android

Hey Unity Answer peeps,

I’m trying to create a android build of my project But during Packaging Resources i get two kind of errors.

A bit of info:
I’ve installed both android studio and JDK 64bit (with Android 6.0 (Marshmallow) )
The project has no Plugins.
I’ve restarted my PC after installing android studio and JDK.

I’ve searched Unity Answers for my problem but most of them were talking about plugins and androidmanifests file. which i don’t have. and i don’t have a clue what these errors mean.

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\Kevin Breurken\AppData\Local\Android\Sdk\build-tools\24.0.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/Kevin Breurken/AppData/Local/Android/Sdk\platforms\android-24\android.jar" -F bin/resources.ap_

stderr[

]
stdout[

]
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[] progress_strings, Single progress_value, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.HostView:OnGUI()

and this one :

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\Kevin Breurken\AppData\Local\Android\Sdk\build-tools\24.0.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/Kevin Breurken/AppData/Local/Android/Sdk\platforms\android-24\android.jar" -F bin/resources.ap_

stderr[

]
stdout[

]

I am having the same trouble as well.. Hopefully we have a solution soon.

1 Answer

1

I fixed this issue by uninstalling 24 and 23 preview SDK’s from Android Standalone SDK manager.
But I guess in latest Unity (5.3.5) this error must not be happened, even with latest SDK’s installed.

Allright i finally got it to work. But i've done multiple things so i'll post them here for people who will find this later: i followed your tips zakirshikhli: - I used 5.3.5 Unity. - I used Android build tools version 23 - I used SDK version 23. I also changed my SDK location to a location outside of my user folder (it had whitespaces and Android Studio said it didn't like that. ) And i removed the other SDK's manualy. Thank you zakirshikhli for your reply. Now i can continue deving!