android - Not Run App With Admob (help) Error (Import -


please send tested admob working api 18(android4.2) or higher

mainactivity.java

error @ import files not exist related admob import com.google.android.gms.ads.adrequest; import com.google.android.gms.ads.adview;

package com.a.test;  import android.app.activity; 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 activity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);         adrequest adrequest = new adrequest.builder()         .build();         adview adview = (adview) view.findviewbyid(r.id.adview);         adview.loadad(adrequest);     } } 

androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.a.test"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="8"         android:targetsdkversion="19" />       <uses-permission android:name="android.permission.access_network_state"/>     <uses-permission android:name="android.permission.internet"/>     <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >         <activity             android:name="com.a.test.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"/>      </application>  </manifest> 

layout 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/lib/com.google.ads"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="${packagename}.${activityclass}" >      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/hello_world" />      <com.google.android.gms.ads.adview android:id="@+id/adview"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            ads:adsize="banner"                            ads:adunitid="my id"/> </relativelayout> 

hope you've references google play services library within project. if haven't, make sure remove admob sdk jar in /libs/ folder , reference google play services library version 4 or later in project.

in layout, change :

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 

to:

xmlns:ads="http://schemas.android.com/apk/res-auto" 

in manifest, add:

<meta-data         android:name="com.google.android.gms.version"         android:value="@integer/google_play_services_version" /> 

make sure add within <application tag


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -