(Solved)CommandInvokationFailure - failed to re-package

Hi,

I installed new windows, I installed Android Studio and sdk, wrote the root path (user/local/appdata/android/sdk) to external tools window of unity.

I get this error when trying to build apk

error1

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\Hakan\AppData\Local\Android\sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “C:/Users/Hakan/AppData/Local/Android/sdk\platforms\android-23\android.jar” -F bin/resources.ap_ --extra-packages com.unity.purchasing.amazon:com.chartboost.sdk.unity:com.unity.purchasing:com.android.vending.billing:com.unity.purchasing.googleplay:com.onesignal:com.nifah.iaptestv2 -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\AmazonAppStore\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\AN_Res\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\common\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\GoogleAIDL\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\GooglePlay\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\onesignal-unity\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res”

stderr[

]
stdout[
Configurations:
(default)
mdpi-v4
mdpi-v11
hdpi-v4
hdpi-v11
xhdpi-v4
xhdpi-v11
xxhdpi-v4
xxhdpi-v11

Files:
drawable\ic_onesignal_large_icon_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_onesignal_large_icon_default.png
drawable\ic_stat_onesignal_default.png
Src: (mdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi\ic_stat_onesignal_default.png
Src: (mdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi-v11\ic_stat_onesignal_default.png
Src: (hdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi\ic_stat_onesignal_default.png
Src: (hdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi-v11\ic_stat_onesignal_default.png
Src: (xhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi\ic_stat_onesignal_default.png
Src: (xhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi-v11\ic_stat_onesignal_default.png
Src: (xxhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi\ic_stat_onesignal_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_stat_onesignal_default.png
raw\notification.wav
Src: () D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\raw\notification.wav
AndroidManifest.xml
Src: () AndroidManifest.xml

Resource Dirs:
Type drawable
drawable\ic_onesignal_large_icon_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_onesignal_large_icon_default.png
drawable\ic_stat_onesignal_default.png
Src: (mdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi\ic_stat_onesignal_default.png
Src: (mdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi-v11\ic_stat_onesignal_default.png
Src: (hdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi\ic_stat_onesignal_default.png
Src: (hdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi-v11\ic_stat_onesignal_default.png
Src: (xhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi\ic_stat_onesignal_default.png
Src: (xhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi-v11\ic_stat_onesignal_default.png
Src: (xxhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi\ic_stat_onesignal_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_stat_onesignal_default.png
Type raw
raw\notification.wav
Src: () D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\raw\notification.wav
Including resources from package: C:\Users\Hakan\AppData\Local\Android\sdk\platforms\android-23\android.jar
applyFileOverlay for drawable
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
trying overlaySet Key=file_paths.xml
applyFileOverlay for raw
applyFileOverlay for color
applyF
]
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()

error2

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\Hakan\AppData\Local\Android\sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “C:/Users/Hakan/AppData/Local/Android/sdk\platforms\android-23\android.jar” -F bin/resources.ap_ --extra-packages com.unity.purchasing.amazon:com.chartboost.sdk.unity:com.unity.purchasing:com.android.vending.billing:com.unity.purchasing.googleplay:com.onesignal:com.nifah.iaptestv2 -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\AmazonAppStore\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\AN_Res\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\common\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\GoogleAIDL\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\GooglePlay\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\onesignal-unity\res” -S “D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res”

stderr[

]
stdout[
Configurations:
(default)
mdpi-v4
mdpi-v11
hdpi-v4
hdpi-v11
xhdpi-v4
xhdpi-v11
xxhdpi-v4
xxhdpi-v11

Files:
drawable\ic_onesignal_large_icon_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_onesignal_large_icon_default.png
drawable\ic_stat_onesignal_default.png
Src: (mdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi\ic_stat_onesignal_default.png
Src: (mdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi-v11\ic_stat_onesignal_default.png
Src: (hdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi\ic_stat_onesignal_default.png
Src: (hdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi-v11\ic_stat_onesignal_default.png
Src: (xhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi\ic_stat_onesignal_default.png
Src: (xhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi-v11\ic_stat_onesignal_default.png
Src: (xxhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi\ic_stat_onesignal_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_stat_onesignal_default.png
raw\notification.wav
Src: () D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\raw\notification.wav
AndroidManifest.xml
Src: () AndroidManifest.xml

Resource Dirs:
Type drawable
drawable\ic_onesignal_large_icon_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_onesignal_large_icon_default.png
drawable\ic_stat_onesignal_default.png
Src: (mdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi\ic_stat_onesignal_default.png
Src: (mdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-mdpi-v11\ic_stat_onesignal_default.png
Src: (hdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi\ic_stat_onesignal_default.png
Src: (hdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-hdpi-v11\ic_stat_onesignal_default.png
Src: (xhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi\ic_stat_onesignal_default.png
Src: (xhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xhdpi-v11\ic_stat_onesignal_default.png
Src: (xxhdpi-v4) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi\ic_stat_onesignal_default.png
Src: (xxhdpi-v11) D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\drawable-xxhdpi-v11\ic_stat_onesignal_default.png
Type raw
raw\notification.wav
Src: () D:\Unity Projects\5.3\BetSubscription\Temp\StagingArea\android-libraries\OneSignalConfig\res\raw\notification.wav
Including resources from package: C:\Users\Hakan\AppData\Local\Android\sdk\platforms\android-23\android.jar
applyFileOverlay for drawable
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
trying overlaySet Key=file_paths.xml
applyFileOverlay for raw
applyFileOverlay for color
applyF
]

I hope you can help, thanks

I can build it with unity cloud build so it’s definitely related to my computer but still could not solve it.

Please post the full error message (the one shown in Unity is sometimes truncated since it’s too long).
You can open the editor log and see the full error message.

Thanks for the reply liortal.

I have just solved the issue. Android Studio’s SDK Manager automatically installs RC build tools for android. I deleted it and installed the last stable version for sdk 23. It solved the issue.