- Home /
CommandInvokationFailure: Failed to re-package resources when added GooglePlayGames plugin
Good day. I use deltaDNA Analytics unity plugin and all works fine. But when i adding GooglePlayGames plugin i keep on getting re-package failure errors. Part of error message below:
CommandInvokationFailure: Failed to re-package resources.
C:\Androidsdk\build-tools\25.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Androidsdk\platforms\android-25\android.jar" -F bin/resources.ap_ --extra-packages com.deltadna.android.sdk.notifications:com.google.example.games.mainlibproj:com.google.android.gms.auth.api:com.google.android.gms.auth:com.google.android.gms.base:com.google.android.gms:com.google.android.gms:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.gcm:com.google.android.gms.nearby:com.google.android.gms.tasks:android.support.v4:android.support.v4 -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\deltadna-sdk-notifications-4.2.3\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-auth-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-auth-base-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-7.8.0\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-basement-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-drive-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-games-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-gcm-7.8.0\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-nearby-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-tasks-10.0.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\support-v4-23.1.1\res" -S "D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\support-v4-24.0.0\res"
stderr[
D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-10.0.1\res\values\values.xml:33: error: Attribute "imageAspectRatioAdjust" already defined with incompatible format.
D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-7.8.0\res\values\common_attrs.xml:13: Original attribute defined here.
AndroidManifest.xml:34: error: Error: No resource found that matches the given name (at 'resource' with value '@string/sender_id').
]
stdout[
Configurations:
(default)
Files:
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Including resources from package: C:\Androidsdk\platforms\android-25\android.jar
I think this is conflict between "play-services-base-10.0.1" used by GP and "play-services-base-7.8.0" used DeltaDNA SDK but i dont know how to fix this issue. Both plugins work correctly separated from each other
Answer by liortal · Jan 19, 2017 at 07:19 AM
I'd like to provide some more details for people who run into this issue in the future.
This error message ("Failed to re-package resources") can occur when Unity executes aapt, which is a tool from the Android SDK).
This tool is responsible for packaging all kinds of resources into the final .apk package.
In this specific case, it is failing and the error message shows us why:
A resource named 'imageAspectRatioAdjust' was defined, but is defined again with an incompatible format. The error also shows the paths where this resource is found:stderr[ D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-10.0.1\res\values\values.xml:33: error: Attribute "imageAspectRatioAdjust" already defined with incompatible format. D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-7.8.0\res\values\common_attrs.xml:13: Original attribute defined here. AndroidManifest.xml:34: error: Error: No resource found that matches the given name (at 'resource' with value '@string/sender_id'). ]
D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-10.0.1 D:\D\Unity\Projects\AllPlugin1\Temp\StagingArea\android-libraries\play-services-base-7.8.0
As you can see, the same google play services library (play-services-base) exists twice in the project, but in 2 different versions.
In this case, the fix was to remove one of them (the older one).
NOTE: If someone faces such an issue, but cannot resolve it himself - I provide a professional service for resolving such Android build issues. Feel free to contact me.
Your answer
Follow this Question
Related Questions
How do I remove appcompat-v7-23.1.1.aar? 1 Answer
Cannot Convert Classes to dex format 2 Answers
Building android application 1 Answer