(Solved) Admob plugin: Failed to re-package resources.

Hi there, I’ve encountered a problem when trying to use the google admob plugin for my unity3d project. The issue is that it fails to compile after I imported it and I have no idea why this happens. I’ve researched on countless other issues that are similar to mine but nothing so far fixed it for me. Does anyone know how to fix this exact issue?

Trying to compile I get this message: Failed to re-package resources. See the console for details

So I open the console to check and there’s this error:

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
D:\Android\sdk\build-tools\23.0.2\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/Android/sdk\platforms\android-21\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.google.android.gms:com.google.unity:com.google.android.gms.ads:com.google.android.gms:android.support.v4 -S "C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res" -S "C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res" -S "C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\GoogleMobileAdsPlugin\res" -S "C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\play-services-ads-8.4.0\res" -S "C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\play-services-basement-8.4.0\res" -S "C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\support-v4-23.1.1\res"

stderr[
C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\admob_ads_attrs.xml:10: error: Attribute "adSize" has already been defined

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\admob_ads_attrs.xml:17: error: Attribute "adSizes" has already been defined

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\admob_ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_attrs.xml:13: error: Attribute "imageAspectRatioAdjust" has already been defined

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_attrs.xml:22: error: Attribute "imageAspectRatio" has already been defined

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_attrs.xml:27: error: Attribute "circleCrop" has already been defined

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\values-v23\values-v23.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\values-v23\values-v23.xml:30: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

]
stdout[
Configurations:
 (default)

Files:
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
Including resources from package: D:\Android\sdk\platforms\android-21\android.jar
applyFileOverlay for drawable
trying overlaySet Key=cast_ic_notification_0.png
trying overlaySet Key=cast_ic_notification_1.png
trying overlaySet Key=cast_ic_notification_2.png
trying overlaySet Key=cast_ic_notification_connecting.xml
trying overlaySet Key=cast_ic_notification_on.png
trying overlaySet Key=common_full_open_on_phone.png
trying overlaySet Key=common_google_signin_btn_icon_dark.xml
trying overlaySet Key=common_google_signin_btn_icon_dark_disabled.9.png
trying overlaySet Key=common_google_signin_btn_icon_dark_focused.9.png
trying overlaySet Key=common_google_signin_btn_icon_dark_normal.9.png
trying overlaySet Key=common_google_signin_btn_icon_dark_pressed.9.png
trying overlaySet Key=common_google_signin_btn_icon_light.xml
trying overlaySet Key=common_google_signin_btn_icon_light_disabled.9.png
trying overlaySet Key=common_google_signin_btn_icon_light_focused.9.png
trying overlaySet Key=common_google_signin_btn_icon_light_normal.9.png
trying overlaySet Key=common_google_signin_btn_icon_light_pressed.9.png
trying overlaySet Key=common_google_signin_btn_text_dark.xml
trying overlaySet Key=common_google_signin_btn_text_dark_disabled.9.png
trying overlaySet Key=common_google_signin_btn_text_dark_focused.9.png
trying overlaySet Key=common_google_signin_btn_text_dark_normal.9.png
trying overlaySet Key=common_google_signin_btn_text_dark_pressed.9.png
trying overlaySet Key=common_google_signin_btn_text_light.xml
trying overlaySet Key=common_google_signin_btn_text_light_disabled.9.png
trying overlaySet Key=common_google_signin_btn_text_light_focused.9.png
trying overlaySet Key=common_google_signin_btn_text_light_normal.9.png
trying overlaySet Key=common_google_signin_btn_text_light_pressed.9.png
trying overlaySet Key=common_ic_googleplayservices.png
trying overlaySet Key=common_plus_signin_btn_icon_dark.xml
trying overlaySet Key=common_plus_signin_btn_icon_dark_disabled.9.png
trying overlaySet Key=common_plus_signin_btn_icon_dark_focused.9.png
trying overlaySet Key=common_plus_signin_btn_icon_dark_normal.9.png
trying overlaySet Key=common_plus_signin_btn_icon_dark_pressed.9.png
trying overlaySet Key=common_plus_signin_btn_icon_light.xml
trying overlaySet Key=common_plus_signin_btn_icon_light_disabled.9.png
trying overlaySet Key=common_plus_signin_btn_icon_light_focused.9.png
trying overlaySet Key=common_plus_signin_btn_icon_light_normal.9.png
trying overlaySet Key=common_plus_signin_btn_icon_light_pressed.9.png
trying overlaySet Key=common_plus_signin_btn_text_dark.xml
trying overlaySet Key=common_plus_signin_btn_text_dark_disabled.9.png
trying overlaySet Key=common_plus_signin_btn_text_dark_focused.9.png
trying overlaySet Key=common_plus_signin_btn_text_dark_normal.9.png
trying overlaySet Key=common_plus_signin_btn_text_dark_pressed.9.png
trying overlaySet Key=common_plus_signin_btn_text_light.xml
trying overlaySet Key=common_plus_signin_btn_text_light_disabled.9.png
trying overlaySet Key=common_plus_signin_btn_text_light_focused.9.png
trying overlaySet Key=common_plus_signin_btn_text_light_normal.9.png
trying overlaySet Key=common_plus_signin_btn_text_light_pressed.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=places_ic_clear.png
trying overlaySet Key=places_ic_search.png
trying overlaySet Key=powered_by_google_dark.png
trying overlaySet Key=powered_by_google_light.png
trying overlaySet Key=abc_ab_share_pack_mtrl_alpha.9.png
trying overlaySet Key=abc_action_bar_item_background_material.xml
trying overlaySet Key=abc_btn_borderless_material.xml
trying overlaySet Key=abc_btn_check_material.xml
trying overlaySet Key=abc_btn_check_to_on_mtrl_000.png
trying overlaySet Key=abc_btn_check_to_on_mtrl_015.png
trying overlaySet Key=abc_btn_colored_material.xml
trying overlaySet Key=abc_btn_default_mtrl_shape.xml
trying overlaySet Key=abc_btn_radio_material.xml
trying overlaySet Key=abc_btn_radio_to_on_mtrl_000.png
trying overlaySet Key=abc_btn_radio_to_on_mtrl_015.png
trying overlaySet Key=abc_btn_rating_star_off_mtrl_alpha.png
trying overlaySet Key=abc_btn_rating_star_on_mtrl_alpha.png
trying overlaySet Key=abc_btn_switch_to_on_mtrl_00001.9.png
trying overlaySet Key=abc_btn_switch_to_on_mtrl_00012.9.png
trying overlaySet Key=abc_cab_background_internal_bg.xml
trying overlaySet Key=abc_cab_background_top_material.xml
trying overlaySet Key=abc_cab_background_top_mtrl_alpha.9.png
trying overlaySet Key=abc_control_background_material.xml
trying overlaySet Key=abc_dialog_material_background_dark.xml
trying overlaySet Key=abc_dialog_material_background_light.xml
trying overlaySet Key=abc_edit_text_material.xml
trying overlaySet Key=abc_ic_ab_back_mtrl_am_alpha.png
trying overlaySet Key=abc_ic_clear_mtrl_alpha.png
trying overlaySet Key=abc_ic_commit_search_api_mtrl_alpha.png
trying overlaySet Key=abc_ic_go_search_api_mtrl_alpha.png
trying overlaySet Key=abc_ic_menu_copy_mtrl_am_alpha.png
trying overlaySet Key=abc_ic_menu_cut_mtrl_alpha.png
trying overlaySet Key=abc_ic_menu_moreoverflow_mtrl_alpha.png
trying overlaySet Key=abc_ic_menu_paste_mtrl_am_alpha.png
trying overlaySet Key=abc_ic_menu_selectall_mtrl_alpha.png
trying overlaySet Key=abc_ic_menu_share_mtrl_alpha.png
trying overlaySet Key=abc_ic_search_api_mtrl_alpha.png
trying overlaySet Key=abc_ic_voice_search_api_mtrl_alpha.png
trying overlaySet Key=abc_item_background_holo_dark.xml
trying overlaySet Key=abc_item_background_holo_light.xml
trying overlaySet Key=abc_list_divider_mtrl_alpha.9.png
trying overlaySet Key=abc_list_focused_holo.9.png
trying overlaySet Key=abc_list_longpressed_holo.9.png
trying overlaySet Key=abc_list_pressed_holo_dark.9.png
trying overlaySet Key=abc_list_pressed_holo_light.9.png
trying overlaySet Key=abc_list_selector_background_transition_holo_dark.xml
trying overlaySet Key=abc_list_selector_background_transition_holo_light.xml
trying overlaySet Key=abc_list_selector_disabled_holo_dark.9.png
trying overlaySet Key=abc_list_selector_disabled_holo_light.9.png
trying overlaySet Key=abc_list_selector_holo_dark.xml
trying overlaySet Key=abc_list_selector_holo_light.xml
trying overlaySet Key=abc_menu_hardkey_panel_mtrl_mult.9.png
trying overlaySet Key=abc_popup_background_mtrl_mult.9.png
trying overlaySet Key=abc_ratingbar_full_material.xml
trying overlaySet Key=abc_scrubber_control_off_mtrl_alpha.png
trying overlaySet Key=abc_scrubber_control_to_pressed_mtrl_000.png
trying overlaySet Key=abc_scrubber_control_to_pressed_mtrl_005.png
trying overlaySet Key=abc_scrubber_primary_mtrl_alpha.9.png
trying overlaySet Key=abc_scrubber_track_mtrl_alpha.9.png
trying overlaySet Key=abc_seekbar_thumb_material.xml
trying overlaySet Key=abc_seekbar_track_material.xml
trying overlaySet Key=abc_spinner_mtrl_am_alpha.9.png
trying overlaySet Key=abc_spinner_textfield_background_material.xml
trying overlaySet Key=abc_switch_thumb_material.xml
trying overlaySet Key=abc_switch_track_mtrl_alpha.9.png
trying overlaySet Key=abc_tab_indicator_material.xml
trying overlaySet Key=abc_tab_indicator_mtrl_alpha.9.png
trying overlaySet Key=abc_text_cursor_material.xml
trying overlaySet Key=abc_textfield_activated_mtrl_alpha.9.png
trying overlaySet Key=abc_textfield_default_mtrl_alpha.9.png
trying overlaySet Key=abc_textfield_search_activated_mtrl_alpha.9.png
trying overlaySet Key=abc_textfield_search_default_mtrl_alpha.9.png
trying overlaySet Key=abc_textfield_search_material.xml
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
trying overlaySet Key=place_autocomplete_fragment.xml
trying overlaySet Key=place_autocomplete_item_powered_by_google.xml
trying overlaySet Key=place_autocomplete_item_prediction.xml
trying overlaySet Key=place_autocomplete_progress.xml
trying overlaySet Key=abc_action_bar_title_item.xml
trying overlaySet Key=abc_action_bar_up_container.xml
trying overlaySet Key=abc_action_bar_view_list_nav_layout.xml
trying overlaySet Key=abc_action_menu_item_layout.xml
trying overlaySet Key=abc_action_menu_layout.xml
trying overlaySet Key=abc_action_mode_bar.xml
trying overlaySet Key=abc_action_mode_close_item_material.xml
trying overlaySet Key=abc_activity_chooser_view.xml
trying overlaySet Key=abc_activity_chooser_view_list_item.xml
trying overlaySet Key=abc_alert_dialog_button_bar_material.xml
trying overlaySet Key=abc_alert_dialog_material.xml
trying overlaySet Key=abc_dialog_title_material.xml
trying overlaySet Key=abc_expanded_menu_layout.xml
trying overlaySet Key=abc_list_menu_item_checkbox.xml
trying overlaySet Key=abc_list_menu_item_icon.xml
trying overlaySet Key=abc_list_menu_item_layout.xml
trying overlaySet Key=abc_list_menu_item_radio.xml
trying overlaySet Key=abc_popup_menu_item_layout.xml
trying overlaySet Key=abc_screen_content_include.xml
trying overlaySet Key=abc_screen_simple.xml
trying overlaySet Key=abc_screen_simple_overlay_action_mode.xml
trying overlaySet Key=abc_screen_toolbar.xml
trying overlaySet Key=abc_search_dropdown_item_icons_2line.xml
trying overlaySet Key=abc_search_view.xml
trying overlaySet Key=abc_select_dialog_material.xml
trying overlaySet Key=notification_media_action.xml
trying overlaySet Key=notification_media_cancel_action.xml
trying overlaySet Key=notification_template_big_media.xml
trying overlaySet Key=notification_template_big_media_narrow.xml
trying overlaySet Key=notification_template_lines.xml
trying overlaySet Key=notification_template_media.xml
trying overlaySet Key=notification_template_part_chronometer.xml
trying overlaySet Key=notification_template_part_time.xml
trying overlaySet Key=select_dialog_item_material.xml
trying overlaySet Key=select_dialog_multichoice_material.xml
trying overlaySet Key=select_dialog_singlechoice_material.xml
trying overlaySet Key=support_simple_spinner_dropdown_item.xml
applyFileOverlay for anim
trying overlaySet Key=abc_fade_in.xml
trying overlaySet Key=abc_fade_out.xml
trying overlaySet Key=abc_grow_fade_in_from_bottom.xml
trying overlaySet Key=abc_popup_enter.xml
trying overlaySet Key=abc_popup_exit.xml
trying overlaySet Key=abc_shrink_fade_out_from_bottom.xml
trying overlaySet Key=abc_slide_in_bottom.xml
trying overlaySet Key=abc_slide_in_top.xml
trying overlaySet Key=abc_slide_out_bottom.xml
trying overlaySet Key=abc_slide_out_top.xml
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_google_signin_btn_text_dark.xml
trying overlaySet Key=common_google_signin_btn_text_light.xml
trying overlaySet Key=common_plus_signin_btn_text_dark.xml
trying overlaySet Key=common_plus_signin_btn_text_light.xml
trying overlaySet Key=wallet_primary_text_holo_light.xml
trying overlaySet Key=wallet_secondary_text_holo_dark.xml
trying overlaySet Key=abc_background_cache_hint_selector_material_dark.xml
trying overlaySet Key=abc_background_cache_hint_selector_material_light.xml
trying overlaySet Key=abc_color_highlight_material.xml
trying overlaySet Key=abc_primary_text_disable_only_material_dark.xml
trying overlaySet Key=abc_primary_text_disable_only_material_light.xml
trying overlaySet Key=abc_primary_text_material_dark.xml
trying overlaySet Key=abc_primary_text_material_light.xml
trying overlaySet Key=abc_search_url_text.xml
trying overlaySet Key=abc_secondary_text_material_dark.xml
trying overlaySet Key=abc_secondary_text_material_light.xml
trying overlaySet Key=switch_thumb_material_dark.xml
trying overlaySet Key=switch_thumb_material_light.xml
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-mdpi\abc_ab_share_pack_mtrl_alpha.9.png
Processing image: C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-hdpi\abc_ab_share_pack_mtrl_alpha.9.png
Processing image: C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-xhdpi\abc_ab_share_pack_mtrl_alpha.9.png
Processing image: C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-xxhdpi\abc_ab_share_pack_mtrl_alpha.9.png
    (processed image C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-mdpi\abc_ab_share_pack_mtrl_alpha.9.png: 253% size of source)
    (processed image C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-hdpi\abc_ab_share_pack_mtrl_alpha.9.png: 256% size of source)
    (processed image C:\Users\Public\Documents\Unity Projects\Admobtest_New\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\drawable-xhdpi\abc_ab_share_pack_mtrl_alpha.9.png: 253% size of source)
Processing image: C:\User<message truncated>

resouce error
if you just want integrate admob in your app,

you can try https://github.com/unity-plugins/Unity-Admob/

It not reqired extra resource

I managed to fix this by updating the SDK manager. My issue was that the SDK manager was outdated, which is why only the older versions of the plugin were working.