Я пытаюсь добавить службу AdMob в проект Unity. Для устройств iOS он работает хорошо. Но для устройств Android он выводит ошибку компиляции.Внедрить службу AdMob в Unity
То, что я сделал это
(1) Есть единичную идентификатор AdMob и вставьте его в исходный код (C#).
(2) Плагин AdmMob Unity для Unity.
(3) Импортируйте google-play-services_lib в папку Asset/Plugins/Android.
И я попытался удалить и повторно импортировать пакет и удалить временную папку. Но он все еще не работал.
Как я могу это решить?
Это журнал.
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Users/kazuhiko/Library/Android/sdk/build-tools/23.0.2/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/kazuhiko/Library/Android/sdk/platforms/android-23/android.jar" -F bin/resources.ap_ --extra-packages com.google.unity:android.support.v7.appcompat:com.google.android.gms:com.google.android.gms.ads:com.google.android.gms:android.support.v4 -S "/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res" -S "/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res" -S "/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/play-services-ads-8.4.0/res" -S "/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/play-services-basement-8.4.0/res" -S "/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/support-v4-23.1.1/res"
stderr[
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_alert_dialog_button_bar_material.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from <android.support.v7.widget.ButtonBarLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_alert_dialog_button_bar_material.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/abc_alert_dialog_button_bar_material for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_alert_dialog_material.xml:48: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from <android.support.v7.widget.DialogTitle>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_alert_dialog_material.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/abc_alert_dialog_material for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_dialog_title_material.xml:29: note: removing attribute http://schemas.android.com/apk/res/android:textAlignment from <TextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_dialog_title_material.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/abc_dialog_title_material for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_screen_toolbar.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:touchscreenBlocksFocus from <android.support.v7.widget.ActionBarContainer>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_screen_toolbar.xml: note: using v21 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/abc_screen_toolbar for configuration v21.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_search_view.xml:47: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/abc_search_view.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/abc_search_view for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media.xml:42: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media.xml:34: note: removing attribute http://schemas.android.com/apk/res/android:layout_toStartOf from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/notification_template_big_media for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml:60: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from <ImageView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml:46: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml:46: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml:38: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml:38: note: removing attribute http://schemas.android.com/apk/res/android:layout_toStartOf from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml:30: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentEnd from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_big_media_narrow.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/notification_template_big_media_narrow for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_lines.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingEnd from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_lines.xml:77: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_lines.xml:96: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <TextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_lines.xml:64: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <TextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_lines.xml:27: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_lines.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/notification_template_lines for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_media.xml:43: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_media.xml:33: note: removing attribute http://schemas.android.com/apk/res/android:layoutDirection from <LinearLayout>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_media.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/notification_template_media for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_part_chronometer.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <Chronometer>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_part_chronometer.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/notification_template_part_chronometer for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_part_time.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <DateTimeView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/notification_template_part_time.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/notification_template_part_time for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_powered_by_google.xml:28: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from <ImageView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_powered_by_google.xml:28: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <ImageView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_powered_by_google.xml:8: note: removing attribute http://schemas.android.com/apk/res/android:layout_marginStart from <View>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_powered_by_google.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/place_autocomplete_item_powered_by_google for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_prediction.xml:52: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from <TextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_prediction.xml:35: note: removing attribute http://schemas.android.com/apk/res/android:layout_toEndOf from <TextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_prediction.xml:8: note: removing attribute http://schemas.android.com/apk/res/android:layout_alignParentStart from <include>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_item_prediction.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/place_autocomplete_item_prediction for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_progress.xml:2: note: removing attribute http://schemas.android.com/apk/res/android:indeterminateTint from <ProgressBar>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_progress.xml:2: note: removing attribute http://schemas.android.com/apk/res/android:indeterminateTintMode from <ProgressBar>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/layout/place_autocomplete_progress.xml: note: using v21 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/place_autocomplete_progress for configuration v21.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/select_dialog_multichoice_material.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <CheckedTextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/select_dialog_multichoice_material.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingEnd from <CheckedTextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/select_dialog_multichoice_material.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/select_dialog_multichoice_material for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/select_dialog_singlechoice_material.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingStart from <CheckedTextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/select_dialog_singlechoice_material.xml:18: note: removing attribute http://schemas.android.com/apk/res/android:paddingEnd from <CheckedTextView>
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res/layout/select_dialog_singlechoice_material.xml: note: using v17 attributes; synthesizing resource com.kazzzstudio.androidadmobtest:layout/select_dialog_singlechoice_material for configuration v17.
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/values/admob_ads_attrs.xml:10: error: Attribute "adSize" has already been defined
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/values/admob_ads_attrs.xml:17: error: Attribute "adSizes" has already been defined
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/values/admob_ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/values/common_attrs.xml:13: error: Attribute "imageAspectRatioAdjust" has already been defined
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/Temp/StagingArea/android-libraries/google-play-services_lib/res/values/common_attrs.xml:22: error: Attribute "imageAspectRatio" has already been defined
/Volumes/Time Machine/Dev/Unity/AndroidAdMobTest/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:
AndroidManifest.xml
Src:() AndroidManifest.xml
Resource Dirs:
Including resour<message truncated>
Я не уверен, в чем проблема, но некоторые советы, проверьте, обновлена ли ваша версия Google Play Sevices в SDK. –
'error: Атрибут adSize уже определен, и аналогичные ошибки означают, что у вас есть библиотека admob sdk, включенная дважды в ваш проект. –
иногда единственные глюки в пакетах android, если у вас все еще есть проблема, попробуйте это: скопируйте весь проект (чтобы создать резервную копию), затем в папке проекта удалите папку «Библиотеки», затем снова откройте этот проект в Unity (единство будет воссоздавать эту папку для вас) и попытайтесь построить –