好的问题没有做任何事情就解决了。AdMob加载广告失败
我使用了以下指南:https://developers.google.com/admob/android/quick-start。并没有这么做,所以我使用onCreate()中的.addTestDevice。然而,广告(横幅请求)仍然无法加载
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("The Correct Code extracted from logcat")
.build();
mAdView.loadAd(adRequest);
的错误是:
06-22 19:40:49.327 2341-2360/nocompany.CashingCash D/dalvikvm﹕ DexOpt: --- BEGIN 'ads117496078.jar' (bootstrap=0) ---
06-22 19:40:49.377 2341-2341/nocompany.CashingCash I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
06-22 19:40:49.377 2341-2341/nocompany.CashingCash I/Ads﹕ Starting ad request.
06-22 19:40:49.397 2341-2360/nocompany.CashingCash D/dalvikvm﹕ DexOpt: --- END 'ads117496078.jar' (success) ---
06-22 19:40:49.397 2341-2360/nocompany.CashingCash D/dalvikvm﹕ DEX prep '/data/data/nocompany.CashingCash/cache/ads117496078.jar': unzip in 0ms, rewrite 71ms
06-22 19:40:52.157 2341-2376/nocompany.CashingCash W/Ads﹕ There was a problem getting an ad response. ErrorCode: 2
06-22 19:40:52.177 2341-2341/nocompany.CashingCash I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
06-22 19:40:52.217 2341-2341/nocompany.CashingCash I/Ads﹕ Scheduling ad refresh 60000 milliseconds from now.
06-22 19:40:52.217 2341-2341/nocompany.CashingCash W/Ads﹕ Failed to load ad: 2
06-22 19:41:52.227 2341-2341/nocompany.CashingCash I/Ads﹕ Starting ad request.
06-22 19:41:52.549 2341-3515/nocompany.CashingCash W/Ads﹕ There was a problem getting an ad response. ErrorCode: 2
06-22 19:41:52.569 2341-2341/nocompany.CashingCash I/Ads﹕ Scheduling ad refresh 60000 milliseconds from now.
06-22 19:41:52.569 2341-2341/nocompany.CashingCash W/Ads﹕ Failed to load ad: 2
这可能是由于我的画布覆盖整个屏幕?
帆布代码:
android:id="@+id/rec_canvas"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#000000" />
确定。我想我确认问题在于画布。我可以通过通货膨胀等方式将广告优先于画布吗?画布刷新每一秒btw。或者我可以重构我的画布以覆盖屏幕的所有部分,但广告?
一些其他的相关代码: (活动主)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:id="@+id/container"
android:layout_height="match_parent" tools:context=".MainActivity"
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/xadView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id" />
(串)
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
(清单)
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/
能见度错误
06-22 19:48:56.968 2341-2341/? I/Ads﹕ Ad is not visible. Not refreshing ad.
06-22 19:48:56.968 2341-2341/? I/Ads﹕ Scheduling ad refresh 60000 milliseconds from now.
06-22 19:49:01.648 1575-1575/? D/HeadsetTangibleController﹕ [TangibleIO] HeadsetTangibleController onAction action = android.intent.action.BATTERY_CHANGED
06-22 19:49:32.518 11424-15647/? E/Ads﹕ Failed to connect to https://googleads.g.doubleclick.net/pagead/drt/m. No DRT retrieved.
确认手机,访问网站和作品的网络连接。 我在仿真器上测试过,它可以工作,但它不适用于实际的手机(LG G3)。
我确实有一个很好的网络连接(4G)。我再次查看了logcat,并提到广告已被覆盖。我会在一分钟内复制代码 – Andy
请将您与标记过滤器逻辑关联为广告 –