Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\sdk\build-tools\23.0.3\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “C:/sdk\platforms\android-23\android.jar” -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.google.firebase:com.google.android.gms.ads.impl:com.google.android.gms.ads:com.google.android.gms.base:com.google.android.gms:com.google.android.gms.tasks:android.support.v4:com.unity3d.ads.android -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\firebase-common-9.0.2\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\play-services-ads-9.0.2\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\play-services-ads-lite-9.0.2\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\play-services-base-9.0.2\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\play-services-basement-9.0.2\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\play-services-tasks-9.0.2\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\support-v4-23.1.1\res” -S “C:\Users\Mardan IT HUB\Documents\Juicy Candy Clash\Temp\StagingArea\android-libraries\unityads-release\res”
If you check your log file I believe you will find that your problem is this: Unity Issue Tracker - Cannot build for Android with AAR with dynamic references like "${applicationId}"
I would guess something has updated for you. I thought newer build tools used dynamic references, but now I’m starting to suspect it could be play-services9.0.2, firebase9.0.2 and probably more and more new stuff.
We need to vote and find a workaround.
As mentioned in my reply below, I resolved the problem by rolling back Android SDK versions to the ones I started working with a few months back in my project:
No problem. I hope I just fixed mine
by rolling back to"GooglePlayGamesPlugin-0.9.32.unitypackage" "GoogleMobileAds.unitypackage" v3.0.3
(Releases · googleads/googleads-mobile-unity · GitHub)
(first deleted them from the project)I also got the whole “android-sdk”
directory(that was 35GB) from my
previous workstation to get the older
version SDK-s and updated ‘Unity
Preferences → External tools’ to
point to that. I also had to delete
all play-services*9.0.2.aar files to
reimport 8.4.0 I had previously. (also
deleted all 9.0.2 firebase)At this point it complained that it
required
“com.google.android.gms:play-services-games
9+”, so I updated the dependencies in
“\ProjectSettings\GoogleDependencyGooglePlayGames.xml”
to 8.4+ I had on the other
workstation. (I would suggest deleting the dependencies when you delete the plugins before installing the older versions)Please be advised that I have been
struggling with this in the last few
days and I don’t think I can point at
the correct root-cause and provide the
correct solution, but I hope this
might help someone.
I think on the Github pages of the plugins Google lists what you need to delete before re-importing the same plugin, but feel free to ask.
Hope this helps. Good luck!