Joakim Carlsson Joakim Carlsson - 3 months ago 37
Android Question

Unity - Error building Player: CommandInvokationFailure: Failed to re-package resources

I'm having some issues with Google Play Services and Unity 5.0.4.
The issue occurs when I want to build my build my project, I get the following error


CommandInvokationFailure: Failed to re-package resources.


I've read a lot and tried to fix it, but no solution been working for me.

I've got the latest Google Play serivces (Rev 32), Google Repository (Rev 32) and Android Support Repository (Rev 35).

I've also read that you can't have API 24 installed, so I've uninstalled and removed it completely. I can't find any other solution to my problem.

Whole console log:


CommandInvokationFailure: Failed to re-package resources.
C:\Android\android-sdk\build-tools\23.0.3\aapt.exe package
--auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Android/android-sdk\platforms\android-23\android.jar" -F
bin/resources.ap_ --extra-packages
com.google.example.games.mainlibproj stderr[ AndroidManifest.xml:19:
error: Error: No resource found that matches the given name (at
'value' with value '@integer/google_play_services_version'). ]
stdout[ Configurations: (default) v14 v21 xhdpi-v4 Files:

drawable\app_banner.png
Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png drawable\app_icon.png
Src: () res\drawable\app_icon.png values\strings.xml
Src: () res\values\strings.xml values\styles.xml
Src: () res\values\styles.xml
Src: (v14) res\values-v14\styles.xml
Src: (v21) res\values-v21\styles.xml AndroidManifest.xml
Src: () AndroidManifest.xml Resource Dirs: Type drawable
drawable\app_banner.png
Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
drawable\app_icon.png
Src: () res\drawable\app_icon.png Type values
values\strings.xml
Src: () res\values\strings.xml
values\styles.xml
Src: () res\values\styles.xml
Src: (v14) res\values-v14\styles.xml
Src: (v21) res\values-v21\styles.xml Including resources from package: C:\Android\android-sdk\platforms\android-23\android.jar
applyFileOverlay for drawable applyFileOverlay for layout
applyFileOverlay for anim applyFileOverlay for animator
applyFileOverlay for interpolator applyFileOverlay for transition
applyFileOverlay for xml applyFileOverlay for raw applyFileOverlay for
color applyFileOverlay for menu applyFileOverlay for mipmap Processing
image: res\drawable-xhdpi\app_banner.png Processing image:
res\drawable\app_icon.png
(processed image res\drawable\app_icon.png: 94% size of source)
(processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
(new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
(new resource id app_icon from drawable\app_icon.png #generated) ] UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo
psi, UnityEditor.Android.WaitingForProcessToExit
waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec
(System.String command, System.String args, System.String workingdir,
System.String errorMsg)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources
(UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute
(UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks
(UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()

Answer

There can be following possible problems:

  1. There might be some duplicate jar files in your plugins folder. Find them and remove one of them to fix this problem.
  2. There might be an issue with merging data from more than one manifest files.

Check following posts to get the pointer :

  1. http://forum.unity3d.com/threads/commandinvokationfailure-android-asset-packaging-tool-failed-no-stderr-to-lookup.274631/

  2. http://answers.unity3d.com/questions/1074000/unity-5-android-build-failed-to-re-package-resourc.html

  3. https://github.com/playgameservices/play-games-plugin-for-unity/issues/900

  4. https://github.com/playgameservices/play-games-plugin-for-unity/issues/1011

  5. Error building player for Android in Unity?

EDIT :

You are missing res folder in plugins.

  1. Check this answer : http://stackoverflow.com/a/38076937/4366237

  2. And this forum post : http://forum.unity3d.com/threads/help-cant-build-project-after-trying-to-use-google-play-services.243284/

Comments