The question is answered, right answer was accepted
Problem with Admob + Google Play Services plugin
Hi, I'm having some issues with the Admob plugin. I'm working on a mobile project where I use google play services and after importing the Admob plugin, an error starts appearing during the build: "Failed to re-package resources. The console displays this message:
CommandInvokationFailure: Failed to re-package resources. C:\Users\Thadeu\AppData\Local\Android\android-sdk\build-tools\25.0.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/Thadeu/AppData/Local/Android/android-sdk\platforms\android-25\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.google.example.games.mainlibproj:com.google.android.gms.ads.impl:com.google.android.gms.ads.impl:com.google.android.gms.ads:com.google.android.gms.ads:com.google.android.gms.auth.api:com.google.android.gms.auth:com.google.android.gms.base:com.google.android.gms.base:com.google.android.gms:com.google.android.gms:com.google.android.gms.clearcut:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.gass:com.google.android.gms.nearby:com.google.android.gms.tasks:android.support.v4:android.support.v4 -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-ads-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-ads-9.4.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-ads-lite-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-ads-lite-9.4.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-auth-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-auth-base-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-9.4.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-basement-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-basement-9.4.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-clearcut-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-drive-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-games-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-gass-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-nearby-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-tasks-10.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\support-v4-23.0.0\res" -S "C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\support-v4-24.0.0\res"
stderr[ C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_alert_dialog_material.xml:111: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_alert_dialog_material.xml:48: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_alert_dialog_material.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/abc_alert_dialog_material for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_dialog_title_material.xml:29: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_dialog_title_material.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/abc_dialog_title_material for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_screen_toolbar.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:touchscreenBlocksFocus from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_screen_toolbar.xml: note: using v21 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/abc_screen_toolbar for configuration v21. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_search_view.xml:47: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\abc_search_view.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/abc_search_view for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media.xml:42: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_toStartOf from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/notification_template_big_media for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml:60: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml:46: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml:46: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml:38: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml:38: note: removing attribute http://schemas.android.com/apk/res/android:layout_toStartOf from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml:30: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentEnd from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_big_media_narrow.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/notification_template_big_media_narrow for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_lines.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingEnd from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_lines.xml:77: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_lines.xml:96: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_lines.xml:64: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_lines.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_lines.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/notification_template_lines for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_media.xml:43: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_media.xml:33: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_media.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/notification_template_media for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_part_chronometer.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_part_chronometer.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/notification_template_part_chronometer for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_part_time.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\layout\notification_template_part_time.xml: note: using v17 attributes; synthesizing resource br.com.bozilgamestudios.parea241:layout/notification_template_part_time for configuration v17. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\drawable\abc_textfield_search_material.xml:19: note: removing attribute http://schemas.android.com/apk/res/android:state_activated from C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\appcompat-v7-23.0.0\res\drawable\abc_textfield_search_material.xml: note: using v11 attributes; synthesizing resource br.com.bozilgamestudios.parea241:drawable/abc_textfield_search_material for configuration v11. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res\values\values.xml:33: error: Attribute "imageAspectRatioAdjust" already defined with incompatible format. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-basement-9.4.0\res\values\values.xml:3: Original attribute defined here. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res\values\values.xml:46: error: Attribute "buttonSize" already defined with incompatible format. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-9.4.0\res\values\values.xml:21: Original attribute defined here. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res\values\values.xml:54: error: Attribute "colorScheme" already defined with incompatible format. C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-9.4.0\res\values\values.xml:21: Original attribute defined here. ] stdout[ Configurations: (default)
Files: AndroidManifest.xml Src: () AndroidManifest.xml
Resource Dirs: Including resources from package: C:\Users\Thadeu\AppData\Local\Android\android-sdk\platforms\android-25\android.jar applyFileOverlay for drawable 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_li
I have already looked at several topics in this forum but I have not been able to solve it yet.
Thank you.
Answer by liortal · Dec 02, 2016 at 11:43 PM
Out of the long error message that Unity shows, this is the actual error:
Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res\values\values.xml:33: error: Attribute "imageAspectRatioAdjust" already defined with incompatible format.
C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-basement-9.4.0\res\values\values.xml:3: Original attribute defined here.
C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res\values\values.xml:46: error: Attribute "buttonSize" already defined with incompatible format.
C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-9.4.0\res\values\values.xml:21: Original attribute defined here.
C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-10.0.0\res\values\values.xml:54: error: Attribute "colorScheme" already defined with incompatible format.
C:\Users\Thadeu\Documents\Projetos Unity\ProjetoPEC241\Temp\StagingArea\android-libraries\play-services-base-9.4.0\res\values\values.xml:21: Original attribute defined here. ]
This kind of issue occurs when Unity builds your final APK, and invokes certain tools from the Android SDK. In particular, it tries to package all of your resources together into the final game package. Resources are identified by an id, but in your case, a resource with the same ID is defined multiple times, so the aapt tool fails with an error.
For example - the resource named 'imageAspectRatioAdjust' is defined multiple times.
From the error itself, it's hard to determine where exactly these resources are defined, but a hint that can be seen is that you have multiple versions of google play services (some libraries are versioned at 9.4.0 while others at 10.0.0).
You should check that you don't have any duplicated versions of the same Google play services libraries. If you find duplications -- remove them (keep only 1 set of google play services libraries).
NOTE: I provide a service for fixing this exact type of issues. It usually takes no more than 5-10 minutes, and if anyone is interested, you can contact me here.
Follow this Question
Related Questions
how to make unlock/lock sytem for player selection? 0 Answers
Admob impressions are not counted 0 Answers
My game is'nt working when i update it on GooglePlay 0 Answers
Google Mobile Ads Unity Plugin v6.1.1 won't load in Editor. Admob incompatible with Firebase? 1 Answer
Admob ads not working no matter waht 1 Answer