我想从Admob切换到亚马逊广告,所以我基本上完成了所有操作,并在官方指南中进行了描述。
https://developer.amazon.com/sdk/mobileads/quick-start.html
广告没有炫耀,因为它们似乎确定了错误的尺寸。
这是日志
07-29 10:03:14.948 30966-30966/de.android.contacts D/AmazonMobileAds Configuration: Setting country configuration to United States.
07-29 10:03:14.948 30966-30966/de.android.contacts D/AmazonMobileAds Configuration: Country code set to us
07-29 10:03:14.948 30966-30966/de.android.contacts D/AmazonMobileAds Configuration: Setting configuration endpoints to North America.
07-29 10:03:14.948 30966-30966/de.android.contacts D/AmazonMobileAds Configuration: Region set to na
07-29 10:03:18.623 31130-31134/com.rectangularsoftware.stackanywhere D/dalvikvm: Debugger has detached; object registry had 1 entries
07-29 10:03:18.668 30966-30966/de.android.contacts D/AmazonMobileAds AdLayout: Ad size to be determined automatically.
07-29 10:03:34.558 2236-2318/system_process D/lights: set_light_buttons off
07-29 10:03:38.668 30966-31146/de.android.contacts E/AmazonMobileAds AdLayout: Can't load an ad because the view size cannot be determined.
07-29 10:03:38.668 30966-31146/de.android.contacts D/AmazonMobileAds AdController: adFailed
07-29 10:03:38.673 30966-30966/de.android.contacts D/AmazonMobileAds AdController: Default ad listener called - Ad Failed to Load. Error code: REQUEST_ERROR, Error Message: Can't load an ad because the view size cannot be determined.
国家代码也是错误的,在我的情况下应该是德国。
什么可能导致这个问题?
答案 0 :(得分:1)
您需要在Amazon:adSize
中添加com.amazon.device.ads.AdLayout
属性。您还需要将此架构添加到xml文件的父LinearLayout或RelativeLayout:
xmlns:Amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads"
或者它无法识别Amazon:adSize属性。
有关可用尺寸的更多信息here。
答案 1 :(得分:0)
您是否设置了adSize属性?
您还需要设置layout_width和layout_height以匹配adSize属性。
<com.amazon.device.ads.AdLayout
android:id="@+id/adview"
Amazon:adSize="1024x50"
android:layout_width="1024dp"
android:layout_height="50dp"/>
如果您想要将广告设为AutoSize,可以执行以下操作:
<com.amazon.device.ads.AdLayout
android:id="@+id/adview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
如果这样做无效,请查看this文档,看看是否有帮助。