Failed to re-package resources.

Hi,

I’ve lost a lot of time trying to find out what could solve this problem with no success. I’m getting this error in console:

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Program Files (x86)\Android\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:/Program Files (x86)/Android/android-sdk\platforms\android-23\android.jar” -F bin/resources.ap_

stderr[

]
stdout[

]

and tried a lot of things, but seems nothing is working. I have no plugins, no Plugin/Android folder, I haven’t change AndroidManifest, I reinstalled SDK and install Google play services and almost everything else :), I have JAVA_PATH defined and CAN’T FIND google_play_games_lib folder in sdk (maybe this is the problem, but don’t know how to fix it) and still nothing. My Unity version is 5.3.4f1 personal edition.

Please help, thank you.
Best regards,
SG

@fisherman89

After defining JAVA_PATH in Environment Variables you must restart your PC for it to work properly.
Double check that you set the right path in case you have both x86 and x64. Choose the one you defined in Unity. I had read that x86 works better for some people.

Also check for duplicates in /Plugins/Android/ directory. Confirm your build tools version and support files version. I once had this problem when my files were version 23 but my build version 24, downgrading fixed this problem.

Also you can delete last theme lines in /Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml
, which sometimes may create similar build errors.

You can try to go Assets > Google Play Services > Resolve Client Jars in unity menu.

If nothing helps you can try close unity completely, then delete all plugins from the folder including dependencies from \ProjectSettings. Then import them again.
Note that if you try deleting while still in unity, it might re-import plugin files automatically.

Never forget to backup important files before making changes.

Google has changed the way they distribute their SDK since this year. Now, instead of google_play_games_lib they provide separate folders for each developer need and thus minimizing build size.
You can find them in \android-sdk\extras\google\m2repository\

Hope I helped you somehow.

Hello @Matsak,

thank you for your time. I actually don’t have any plugins. I’ve tried everything you said and still nothing. I will try to remove unity and everything with it and install it again.

Again thanks,
SG