java - Android Admob not showing in emulator it is blank -


i have been following android quick start tutorial https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start put admob on emulator , not working missing.i have copied tutorial word word , not work.also have checked logcat , got error could not find class 'android.app.appopsmanager',referenced method com.google.android.gms.common.googleplayservicesutil.zza . seems internal error them.i have upgraded new android studio 1.2.1.1 worth .here basic code

main.java

  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().build();         madview.loadad(adrequest);     } 

acitivity_main.xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"     xmlns:ads="http://schemas.android.com/apk/res-auto"     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=".main">      <textview android:text="@string/hello_world" android:layout_width="wrap_content"         android:layout_height="wrap_content" />      <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_alignparentbottom="true"         android:layout_alignparentleft="true"         android:layout_alignparentstart="true">     </com.google.android.gms.ads.adview>  </relativelayout> 

androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example" >     <uses-permission android:name="android.permission.internet"/>     <uses-permission android:name="android.permission.access_network_state"/>     <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=".main"             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>  </manifest> 

gradle

dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:22.0.0'     compile 'com.google.android.gms:play-services:7.3.0' } 

strings xml

<resources>     <string name="app_name">adsensecalculator</string>     <string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>     <string name="hello_world">hello world!</string>     <string name="action_settings">settings</string> </resources> 

add code:

adrequest adrequest = new adrequest.builder()         .addtestdevice(adrequest.device_id_emulator)    // remove when exporting signed apk         .addtestdevice(getdeviceid())       // remove when exporting signed apk         .build(); 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -