Unity ads Error building Player: CommandInvokationFailure: Failed to re-package resources.

Hi,

I know there was many threads like this, yesterday was everything ok, now when I try to build my game on Android I get this error. From other treads most problems was related to goodle play services i dont have it in my project so this is not the issue, there were some solutions with changing projects direction because file strings were too long for Windows but this is also not the isuee. I’ve had also updated Android SDK build tools to latest 23.0.1 From the error there something wrong with unity ads service which i have in my game but i can’t figure it out, please help
using Unity 5.3.1f1, Win8, Android SDK build tools 23.0.1

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Android\sdk\build-tools\23.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Android/sdk\platforms\android-21\android.jar" -F bin/resources.ap_ --extra-packages com.google.android.gms:com.google.android.gms.ads:com.google.android.gms.ads:com.google.android.gms:com.google.android.gms:android.support.v4:android.support.v4:com.unity3d.ads.android -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-ads-8.3.0\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-ads-8.4.0\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-basement-8.3.0\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-basement-8.4.0\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\support-v4-23.1.0\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\support-v4-23.1.1\res" -S "C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res"

stderr[
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:2: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <RelativeLayout>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:61: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <TextView>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <RelativeLayout>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <RelativeLayout>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:52: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <View>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:44: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <View>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:19: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <View>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml:10: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <View>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml: note: using v17 attributes; synthesizing resource com.PrettyFlyGames.Cubic:layout/unityads_button_audio_toggle for configuration v17.
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_pause.xml:8: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <View>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_pause.xml: note: using v17 attributes; synthesizing resource com.PrettyFlyGames.Cubic:layout/unityads_button_pause for configuration v17.
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml:92: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <include>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml:57: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentEnd from <LinearLayout>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml:57: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from <LinearLayout>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml:44: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from <TextView>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml:29: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <TextView>
C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml: note: using v17 attributes; synthesizing resource com.PrettyFlyGames.Cubic:layout/unityads_view_video_play for configuration v17.
C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-basement-8.3.0\res\values\common_attrs.xml:13: error: Attribute "imageAspectRatioAdjust" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-basement-8.3.0\res\values\common_attrs.xml:22: error: Attribute "imageAspectRatio" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-basement-8.3.0\res\values\common_attrs.xml:27: error: Attribute "circleCrop" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-ads-8.3.0\res\values\admob_ads_attrs.xml:10: error: Attribute "adSize" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-ads-8.3.0\res\values\admob_ads_attrs.xml:17: error: Attribute "adSizes" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\play-services-ads-8.3.0\res\values\admob_ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\admob_ads_attrs.xml:10: error: Attribute "adSize" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\admob_ads_attrs.xml:17: error: Attribute "adSizes" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\admob_ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_attrs.xml:13: error: Attribute "imageAspectRatioAdjust" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_attrs.xml:22: error: Attribute "imageAspectRatio" has already been defined

C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_attrs.xml:27: error: Attribute "circleCrop" has already been defined

]
stdout[
Configurations:
 (default)

Files:
  drawable\unityads_background_button_pause.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_background_button_pause.xml
  drawable\unityads_icon_play.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_play.xml
  drawable\unityads_icon_speaker_base.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_speaker_base.xml
  drawable\unityads_icon_speaker_triangle.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_speaker_triangle.xml
  drawable\unityads_icon_speaker_waves.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_speaker_waves.xml
  layout\unityads_button_audio_toggle.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml
  layout\unityads_button_pause.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_pause.xml
  layout\unityads_view_video_paused.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_paused.xml
  layout\unityads_view_video_play.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml
  values\values.xml
    Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\values\values.xml
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
  Type drawable
    drawable\unityads_background_button_pause.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_background_button_pause.xml
    drawable\unityads_icon_play.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_play.xml
    drawable\unityads_icon_speaker_base.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_speaker_base.xml
    drawable\unityads_icon_speaker_triangle.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_speaker_triangle.xml
    drawable\unityads_icon_speaker_waves.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\drawable\unityads_icon_speaker_waves.xml
  Type layout
    layout\unityads_button_audio_toggle.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_audio_toggle.xml
    layout\unityads_button_pause.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_button_pause.xml
    layout\unityads_view_video_paused.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_paused.xml
    layout\unityads_view_video_play.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\layout\unityads_view_video_play.xml
  Type values
    values\values.xml
      Src: () C:\Unity P\Cube\Temp\StagingArea\android-libraries\unityads-release\res\values\values.xml
Including resources from package: C:\Android\sdk\platforms\android-21\android.jar
applyFileOverlay for drawable
trying overlaySet Key=common_full_open_on_phone.png
trying overlaySet Key=common_ic_googleplayservices.png
trying overlaySet Key=common_full_open_on_phone.png
baseFile 0 has flavor mdpi-v4
baseFile 1 has flavor tvdpi-v4
baseFile 2 has flavor hdpi-v4
baseFile 3 has flavor xhdpi-v4
baseFile 4 has flavor xxhdpi-v4
overlayFile 0 has flavor mdpi-v4
overlayFile 1 has flavor tvdpi-v4
overlayFile 2 has flavor hdpi-v4
overlayFile 3 has flavor xhdpi-v4
overlayFile 4 has flavor xxhdpi-v4
found a match (0) for overlay file common_full_open_on_phone.png, for flavor mdpi-v4
found a match (1) for overlay file common_full_open_on_phone.png, for flavor tvdpi-v4
found a match (2) for overlay file common_full_open_on_phone.png, for flavor hdpi-v4
found a match (3) for overlay file common_full_open_on_phone.png, for flavor xhdpi-v4
found a match (4) for overlay file common_full_open_on_phone.png, for flavor xxhdpi-v4
trying overlaySet Key=common_ic_googleplayservices.png
baseFile 0 has flavor hdpi-v4
overlayFile 0 has flavor hdpi-v4
found a match (0) for overlay file common_ic_googleplayservices.png, for flavor hdpi-v4
trying overlaySet Key=common_signin_btn_icon_dark.xml
trying overlaySet Key=common_signin_btn_icon_disabled_dark.9.png
trying overlaySet Key=common_signin_btn_icon_disabled_focus_dark.9.png
trying overlaySet Key=common_signin_btn_icon_disabled_focus_light.9.png
trying overlaySet Key=common_signin_btn_icon_disabled_light.9.png
trying overlaySet Key=common_signin_btn_icon_focus_dark.9.png
trying overlaySet Key=common_signin_btn_icon_focus_light.9.png
trying overlaySet Key=common_signin_btn_icon_light.xml
trying overlaySet Key=common_signin_btn_icon_normal_dark.9.png
trying overlaySet Key=common_signin_btn_icon_normal_light.9.png
trying overlaySet Key=common_signin_btn_icon_pressed_dark.9.png
trying overlaySet Key=common_signin_btn_icon_pressed_light.9.png
trying overlaySet Key=common_signin_btn_text_dark.xml
trying overlaySet Key=common_signin_btn_text_disabled_dark.9.png
trying overlaySet Key=common_signin_btn_text_disabled_focus_dark.9.png
trying overlaySet Key=common_signin_btn_text_disabled_focus_light.9.png
trying overlaySet Key=common_signin_btn_text_disabled_light.9.png
trying overlaySet Key=common_signin_btn_text_focus_dark.9.png
trying overlaySet Key=common_signin_btn_text_focus_light.9.png
trying overlaySet Key=common_signin_btn_text_light.xml
trying overlaySet Key=common_signin_btn_text_normal_dark.9.png
trying overlaySet Key=common_signin_btn_text_normal_light.9.png
trying overlaySet Key=common_signin_btn_text_pressed_dark.9.png
trying overlaySet Key=common_signin_btn_text_pressed_light.9.png
trying overlaySet Key=ic_plusone_medium_off_client.png
trying overlaySet Key=ic_plusone_small_off_client.png
trying overlaySet Key=ic_plusone_standard_off_client.png
trying overlaySet Key=ic_plusone_tall_off_client.png
trying overlaySet Key=powered_by_google_dark.png
trying overlaySet Key=powered_by_google_light.png
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
trying overlaySet Key=gtm_analytics
applyFileOverlay for color
trying overlaySet Key=common_signin_btn_text_dark.xml
trying overlaySet Key=common_signin_btn_text_light.xml
trying overlaySet Key=wallet_primary_text_holo_light.xml
trying overlaySet Key=wallet_secondary_text_holo_dark.xml
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable-xhdpi\app_banner.png
Processing image: res\drawable\app_icon.png
Processing image: res\drawable-ldpi\app_icon.png
Processing image: res\drawable-hdpi\app_icon.png
    (processed image res\drawable-ldpi\app_icon.png: 120% size of source)
Processing image: res\drawable-xhdpi\app_icon.png
    (processed image res\drawable\app_icon.png: 97% size of source)
Processing image: res\drawable-xxhdpi\app_icon.png
    (processed image res\drawable-hdpi\app_icon.png: 93% size of source)
Processing image: res\drawable-xxxhdpi\app_icon.png
    (processed image res\drawable-xhdpi\app_icon.png: 97% size of source)
Processing image: C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_full_open_on_phone.png
    (processed image C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_full_open_on_phone.png: 58% size of source)
Processing image: C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-tvdpi\common_full_open_on_phone.png
    (processed image C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-tvdpi\common_full_open_on_phone.png: 46% size of source)
Processing image: C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_full_open_on_phone.png
    (processed image C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_full_open_on_phone.png: 46% size of source)
Processing image: C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_full_open_on_phone.png
    (processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
Processing image: C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_full_open_on_phone.png
    (processed image C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_full_open_on_phone.png: 46% size of source)
Processing image: C:\Unity P\Cube\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_ic_googleplayservices.png
    (processed image C:\U<message truncated>

OK, after some trials and errors, I’ve found solution. All similar problems are related with duplicated plugin files. My solution was to delete all plugins from Plugins>Angroid which I don’t use in my project in Unity. Funny i dont remember adding them or when they have appeared in my assets. Hope some will find it usefull.71673-plugins.png

EDIT:
Well later it turned out that plugins were for GameAnalytics SDK which i was using, after deleting them, the statistics didn’t worked out at all, but simple update to latest version has suplemented missing files