Android: AdMob not working -
admob won't show in app. every time invoke loadad(..) following errors:
requesting resource 0x7f0b000e failed because complex. google play services resources not found. check project configuration ensure resources included. there problem getting ad response. errorcode: 1
i searched hours solution problem haven't found works me! downloaded latest version of google play services , added them library in project preferences
here code: activity:
public class welcomeactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.setcontentview(r.layout.activity_welcome); // adview resource , load request. adview adview = (adview) this.findviewbyid(r.id.welcomeadview); adrequest.builder adrequestbuilder = new adrequest.builder(); adrequestbuilder.addtestdevice("************"); adrequestbuilder.addtestdevice(adrequest.device_id_emulator); adrequest adrequest = adrequestbuilder.build(); adview.loadad(adrequest); } }
layout xml:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res/xx.xx" android:id="@+id/container" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context="xx.xx.welcomeactivity" > .... other layout stuff ..... <relativelayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignparentbottom="true" > <com.google.android.gms.ads.adview android:id="@+id/welcomeadview" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adsize="banner" ads:adunitid="pub-***************" /> </relativelayout> </relativelayout> androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="xx.xx" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="14" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <application android:allowbackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/theme.holo.light" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="xx.xx.welcomeactivity" android:label="@string/app_name" android:screenorientation="portrait" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> ... more activities ... <activity android:name="com.google.android.gms.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize" > </activity> </application> </manifest>
i don't find issue code/layout. issue ads unit id.
i suggest try creating different ads unit id
hope works.
Comments
Post a Comment