2

I'm getting the following error when I build my APK:

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    C:\Users\Me\AppData\Local\Android\sdk\build-tools\24.0.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/Me/AppData/Local/Android/sdk\platforms\android-24\android.jar" -F bin/resources.ap_ --extra-packages

I wish to integrate "Leaderboards" in my app using Google Play Services. What should I do to fix this?

What I've tried:

  • Reinstalling the Google Play Services plugin.
  • Updating SDK: See here. (tell me if I did it properly).
  • Made sure I have latest versions of "Extras/Android Support Repository" and "Extras/Google Repository".
  • Installed everything in SDK Manager. See here.
  • Updating Unity.
  • Restarting.
  • Few minor changes.
Dinovr
  • 221
  • 1
  • 2
  • 13
  • Some useful links: [1](http://answers.unity3d.com/questions/760989/failed-to-re-package-resources-2.html) [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/1011) – Umair M Jun 28 '16 at 12:08
  • @UmairM I saw these websites before and they didn't offer me a solution. – Dinovr Jun 28 '16 at 12:50
  • Are you using both google-play-services and admob? – Umair M Jun 28 '16 at 12:56
  • @UmairM I'm not using AdMob. – Dinovr Jun 28 '16 at 13:01
  • Can't believe you just installed everything. You will run out of space very soon. I have a possible solution. Is this solved yet? – Programmer Jun 30 '16 at 13:15
  • @Programmer No, my problem still hasn't been solved. – Dinovr Jun 30 '16 at 13:17
  • Ok. You have never accpeted any answer even if most in your questions are very helpful and likely solved your problem. This is how to accept answer: http://i.stack.imgur.com/LkiIZ.png Check back your question and see which ones solved your problem then tick them. Let me know after you do this. – Programmer Jun 30 '16 at 14:00
  • @Programmer Thanks for the reminder. I've now accepted 2 answers. My other questions remain unsolved. – Dinovr Jun 30 '16 at 17:10
  • Nice.Update your question with the version of Unity you are using and the **Minimum API Level** it is set to. Also, mention what Android version your Android device is running. Before I put my answer. Please create a new project then try to **build** it in Android. Not** Build and Run**. Just **Build** it and tell me if you were successful in building it. – Programmer Jun 30 '16 at 17:33
  • @Programmer Hi. I'm writing this from my second account because my main account got suspended (7 days) for voting irregularities. Here we go: I'm currently using **Unity 5.3.5f1**. I have tried downgrading to 5.3.4f1, 5.3.3f1 and 5.3.2f1 but this didn't solve the problem. I have tried to change the minimum API level to recent versions and that didn't solve the problem either. Currently, my API level is set to API level 9. I have created a new project and tried to build the APK and the same error pops up. –  Jul 01 '16 at 08:26
  • @Programmer I usually just **Build** my APK without building and running, so my device's android version doesn't matter here. Finally, I have removed Google Play Services Plugin from my Unity project and I still have the same problem! Even if I create a fresh, brand new Unity project, the error still comes up! I definitely need help now, because I can't build at all... –  Jul 01 '16 at 08:28
  • @Programmer Also, I couldn't find another way to communicate with you. –  Jul 01 '16 at 08:32
  • Try my answer. Comment under it if there is a problem. – Programmer Jul 01 '16 at 17:13

2 Answers2

1

This absolutely will fix your problem.

Download the google_play_services from this link below :

https://dl-ssl.google.com/android/repository/google_play_services_8298000_r28.zip

Then unzip it.

after unzip copy the file to :

android-sdk/extras/google/google_play_services/

Find version.xml file at the zip file:

android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values/

and copy it to :

Assets/Plugins/Android/res/values/

At unity folder

This is work for me.

Dennis Liu
  • 303
  • 5
  • 21
0

To fix this error, you have to copy the version.xml file from

android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values/

into

Assets/Plugins/Android/res/values/

of your Unity project's folder.

Umair M
  • 10,298
  • 6
  • 42
  • 74