Unity 5 Android Build - Failed to re-package resources

Hi UnityAnswers,

I currently have the Google Play Services plugin installed and working with my project. Tonight I attempted to add the AdMob plugin and immediately began running into this error whenever I ran a build. Even after removing the plugin and reverting SVN to the build prior to even installing it, the error remains.

I’ve searched Google for the last three hours (seriously, purple links everywhere) and have tried many things to no avail. It’s driving me absolutely mad.

Here’s my setup:

Unity 5.2.0f3

Android SDK Tools 24.4

Android SDK Platform-Tools 23.0.1

Android SDK Build-Tools 22.0.1 & 21.1.2

I’ve read that it has something to do with the aapt.exe file being moved to the Build-Tools and thus has to be moved (shortcutted?) to the the Platform-Tools. I tried this for both of the versions I have installed (listed above).

I also tried removing the multiple AndroidManifest.xml’s that exist in the android folder, admob, google play etc. I also read something about the version.xml being messed up, though I was unsure how to test that.

Anyway, if anyone has any insight into this, I’d be really grateful!

Here is the error:

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Program Files (x86)\Android\android-sdk\build-tools\22.0.1\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_ --extra-packages com.google.android.gms:com.google.unity:com.google.example.games.mainlibproj -S "C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res"

stderr[
AndroidManifest.xml:17: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').

]
stdout[
Configurations:
 (default)
 mdpi-v4
 tvdpi-v4
 hdpi-v4
 xhdpi-v4
 xxhdpi-v4
 ca
 da
 fa
 ja
 nb
 de
 af
 bg
 th
 fi
 hi
 vi
 sk
 uk
 el
 nl
 pl
 sl
 tl
 am
 in
 ko
 ro
 ar
 fr
 hr
 sr
 tr
 cs
 es
 it
 lt
 pt
 hu
 ru
 zu
 lv
 sv
 iw
 sw
 fr-CA
 lo-LA
 en-GB
 bn-BD
 et-EE
 ka-GE
 ky-KG
 km-KH
 zh-HK
 si-LK
 mk-MK
 ur-PK
 sq-AL
 hy-AM
 my-MM
 zh-CN
 pa-IN
 ta-IN
 te-IN
 ml-IN
 en-IN
 kn-IN
 mr-IN
 gu-IN
 mn-MN
 ne-NP
 pt-BR
 gl-ES
 eu-ES
 is-IS
 es-US
 pt-PT
 en-AU
 zh-TW
 ms-MY
 az-AZ
 kk-KZ
 uz-UZ

Files:
  color\common_signin_btn_text_dark.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\common_signin_btn_text_dark.xml
  color\common_signin_btn_text_light.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\common_signin_btn_text_light.xml
  color\wallet_primary_text_holo_light.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\wallet_primary_text_holo_light.xml
  color\wallet_secondary_text_holo_dark.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\wallet_secondary_text_holo_dark.xml
  drawable\cast_ic_notification_0.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\cast_ic_notification_0.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\cast_ic_notification_0.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\cast_ic_notification_0.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\cast_ic_notification_0.png
  drawable\cast_ic_notification_1.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\cast_ic_notification_1.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\cast_ic_notification_1.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\cast_ic_notification_1.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\cast_ic_notification_1.png
  drawable\cast_ic_notification_2.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\cast_ic_notification_2.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\cast_ic_notification_2.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\cast_ic_notification_2.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\cast_ic_notification_2.png
  drawable\cast_ic_notification_connecting.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\cast_ic_notification_connecting.xml
  drawable\cast_ic_notification_on.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\cast_ic_notification_on.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\cast_ic_notification_on.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\cast_ic_notification_on.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\cast_ic_notification_on.png
  drawable\common_full_open_on_phone.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_full_open_on_phone.png
    Src: (tvdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-tvdpi\common_full_open_on_phone.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_full_open_on_phone.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_full_open_on_phone.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_full_open_on_phone.png
  drawable\common_ic_googleplayservices.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_ic_googleplayservices.png
  drawable\common_signin_btn_icon_dark.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_icon_dark.xml
  drawable\common_signin_btn_icon_disabled_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_dark.9.png
  drawable\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_focus_dark.9.png
  drawable\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_focus_light.9.png
  drawable\common_signin_btn_icon_disabled_light.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_light.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_light.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_light.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_light.9.png
  drawable\common_signin_btn_icon_focus_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_focus_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_focus_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_focus_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_focus_dark.9.png
  drawable\common_signin_btn_icon_focus_light.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_focus_light.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_focus_light.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_focus_light.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_focus_light.9.png
  drawable\common_signin_btn_icon_light.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_icon_light.xml
  drawable\common_signin_btn_icon_normal_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_normal_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_normal_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_normal_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_normal_dark.9.png
  drawable\common_signin_btn_icon_normal_light.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_normal_light.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_normal_light.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_normal_light.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_normal_light.9.png
  drawable\common_signin_btn_icon_pressed_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_pressed_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_pressed_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_pressed_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_pressed_dark.9.png
  drawable\common_signin_btn_icon_pressed_light.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_pressed_light.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_pressed_light.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_pressed_light.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_pressed_light.9.png
  drawable\common_signin_btn_text_dark.xml
    Src: () C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_text_dark.xml
  drawable\common_signin_btn_text_disabled_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_disabled_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_disabled_dark.9.png
  drawable\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (xxhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_disabled_focus_dark.9.png
  drawable\common_signin_btn_text_disabled_focus_light.9.png
    Src: (mdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png
    Src: (hdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_focus_light.9.png
    Src: (xhdpi-v4) C:\Users\San\Desktop\Hexapop	runk\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_b<message truncated>

Just delete the file 24 from C:.…\sdk\build-tools !! :smiley:

maybe is some kind of incompatibility with the latest tools. Good Luck

I was facing the same problem. I solved it by commenting out that tag in the manifest. Didn’t affect my game in any noticeable way.

  <!-- InAppPurchase Activity
    <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
        android:theme="@style/Theme.IAPTheme"/> -->

For those with the same issue, I reverted my project back before I had added admob and messed around with it, and then I followed this tutorial exactly:

The main things I noticed that I didn't do were the first time (when it didn't work):
  1. Remove the theme line from the androidmanifest.xml in the admob plugin (not the main android library one. You should have two if you’re using Google Play Services).

  2. Make a res>version folder inside your admob folder and then copy the version.xml from the same path but in the Google Play plugin.

Anyway, glad that’s done. :slight_smile:

The problem i found was that i had installed the SDK (preview) tools that unistalled the ones at the top of the sdk manager. i uninstalled the preview ones and installed the old ones. and it worked.

I deleted …\android-studio-sdk\build-tools\24.0.0-rc or relevant version or greater than 23.0.3

Unity 5 ( 2016 Jul ) support build-tools ver 23.0.3 ( max ). If you updated any latest android sdk, you may delete folders greater than ver 23.0.3

It works for me. Hope it helps.

Did you try to " reimport all"?

And open the Android SDK manager and download also some older versions of the tools and so on. Because unity does not always like all versions it would pick the one it can use.

Tried to build an empty android projekt on the same system?

Don’t remove anything from current project. Just copy some xml files from local sdk directories those contain above missing ids.

For me I imported 4 xml files from sdk directory and pasted it on GoogleMobileAdsPlugin values folder.

I still haven’t been able to fix this

Google Mobile Ads Unity Plugin v2.0 work for me.

I had the same issue, just resolve it by importing the latest plugin of google ads sdk which is 3.6.0 at the time of writing.
I hope updating the package will help :slight_smile:

You can find latest package here

Regards,
Faisal

In my case it was fixed when I went to Playersettings>Icon>enable android banner (Check it true) Hope it Helps!

Here is A New Video On Fixing All AdMob Problems in Unity (in Hindi/Language) YouTube Link UNITY AdMob Problem Fixed Ads Not Showing ☑ - YouTube