2017-01-16 211 views
0

)您的帳戶橫幅廣告,訂購了所有的關鍵字,佈局,啓動代碼等。因此,廣告不會顯示任何測試廣告,也不會顯示我的橫幅廣告日誌此錯誤出現:Admob橫幅未顯示(Android0

There was a problem getting an ad response. ErrorCode: 0 
W/Ads: Failed to load ad: 0 

做什麼我已經經歷了這個問題整個互聯網的搜索,但沒有解決它橫幅成立10小時前試戴的Android 4.2.2,4.4.2,。 6.0.1

MainActivity:

MobileAds.initialize(getApplicationContext(), "my code"); 
     AdView mAdView = (AdView) findViewById(R.id.adView); 
     AdRequest adRequest = new AdRequest.Builder().build(); 
     mAdView.loadAd(adRequest); 

的main.xml:

<com.google.android.gms.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     ads:adUnitId="@string/banner_ad_unit_id"> 
    </com.google.android.gms.ads.AdView> 

grandle:

dependencies { 
    compile project(':ambilWarna') 
    compile 'com.android.support:support-v4:21.0.3' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'com.google.firebase:firebase-ads:10.0.1' 

} 
apply plugin: 'com.google.gms.google-services' 

的manifest.xml:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.minin.floatbatpercentage" 
    android:versionCode="2" 
    android:versionName="1.1" > 
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> 
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> 
     <uses-permission android:name="android.permission.BOOT_COMPLETED"/> 
    <uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    <uses-permission android:name="android.permission.BATTERY_STATS"/> 
    <uses-sdk 
     android:minSdkVersion="14" 
     android:targetSdkVersion="22" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <service android:name=".FloatingText" 
      android:enabled="true" 
      android:exported="true" > 
     </service> 
     <activity android:name=".Main"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
      <activity 
      android:name=".About" 
       android:configChanges="keyboardHidden|orientation|screenSize" 
       android:label="@string/app_name" 
      > 

     </activity> 
     <receiver 
      android:name=".BootReceiver" 
      android:enabled="true" 
      android:exported="false" > 
      <intent-filter> 
       <action android:name="android.intent.action.BOOT_COMPLETED" /> 
      </intent-filter> 
     </receiver> 
     <receiver 
      android:name=".BatteryReceiver" 
      android:enabled="true" 
      android:exported="false" > 
      <intent-filter> 
       <action android:name="android.intent.action.battery_changed" /> 
      </intent-filter> 
     </receiver> 

    </application> 

</manifest> 

回答

1

只需等待幾個小時,您就可以開始獲取廣告。如果它是新創建的廣告單元ID,則服務器需要一段時間才能在所有實例上進行復制。 代碼沒有問題

+0

Banner於10小時前成立。 – RS90

+0

嘗試在清單中添加此項

+0

未編譯與代碼 – RS90

0

我無法評論,因爲我沒有足夠的代表,所以我當我走過它時會編輯它。你在manifest.xml中有<uses-permission android:name="android.permission.INTERNET" />嗎?

編輯:謝謝,除了你的代碼沒有什麼是錯的。正如Shubham Shukla上面所說的,由於您的ID是新的,它需要時間才能從服務器獲取廣告。

+0

是的。在manifest.xml中: RS90