java - getting an ad response. ErrorCode: 0 -


this first time setting , writing android app, , first time setting ad, i've been googling , testing 2 days still can't seem make ad appear , still gives me error "there problem getting ad response. errorcode: 0". i've followed guide @ here below below, please :(

mainactivity.java

package com.example.lechoonh.admob;  import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem;  import com.google.android.gms.ads.adrequest; import com.google.android.gms.ads.adview;   public class mainactivity extends actionbaractivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      adview madview = (adview) findviewbyid(r.id.adview);     adrequest adrequest = new adrequest.builder()     .addtestdevice("dae102189e22517b3a0c8a79337b74a2")     .build();     madview.loadad(adrequest);   } 

build.gradle

apply plugin: 'com.android.application'  android { compilesdkversion 22 buildtoolsversion "21.1.2"  defaultconfig {     applicationid "com.example.lechoonh.admob"     minsdkversion 9     targetsdkversion 22     versioncode 1     versionname "1.0" } buildtypes {     release {         minifyenabled false         proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'     } } }  dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.google.android.gms:play-services:7.0.0' } 

androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.lechoonh.admob" >      <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:theme="@style/apptheme" >     <meta-data android:name="com.google.android.gms.version"         android:value="@integer/google_play_services_version" />      <activity         android:name=".mainactivity"         android:label="@string/app_name" >         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>     <activity android:name="com.google.android.gms.ads.adactivity"         android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize"         android:theme="@android:style/theme.translucent" />         />  </application> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> 

strings.xml

<resources>     <string name="app_name">admob 2</string>      <string name="hello_world">hello world!</string>     <string name="action_settings">settings</string>     <string name="banner_ad_unit_id">ca-app-pub-xxxxxxxxxxxxx/xxxxx</string> </resources> 

activity_main.xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:tools="http://schemas.android.com/tools"  xmlns:ads="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent"     android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity">    <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"     android:layout_alignparenttop="true"     android:layout_centerhorizontal="true"> </com.google.android.gms.ads.adview> 

picture

ok, turns out should update dependencies

com.google.android.gms:play-services:7.0.0

to com.google.android.gms:play-services:7.3.0

now ads appeared correctly


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -