android - my the app crash when starts admob ads -


hello guys im having problem admob ads everthing right in mainfist meta data , activity , permission every thing ok what's wrong code here

public class fullscreenviewactivity extends activity implements onclicklistener {      private static final string tag = fullscreenviewactivity.class             .getsimplename();     public static final string tag_sel_image = "selectedimage";     private wallpaper selectedphoto;     private imageview fullimageview;     private linearlayout llsetwallpaper, lldownloadwallpaper;     private utils utils;     private progressbar pbloader;     adview minterstitialad;      // picasa json response node keys     private static final string tag_entry = "entry",         tag_media_group = "media$group",         tag_media_content = "media$content", tag_img_url = "url",         tag_img_width = "width", tag_img_height = "height";      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_fullscreen_image);         fullimageview = (imageview) findviewbyid(r.id.imgfullscreen);         llsetwallpaper = (linearlayout) findviewbyid(r.id.llsetwallpaper);         lldownloadwallpaper = (linearlayout) findviewbyid(r.id.lldownloadwallpaper);         pbloader = (progressbar) findviewbyid(r.id.pbloader);         adview minterstitialad = (adview) findviewbyid(r.id.adview);         getactionbar().hide();         utils = new utils(getapplicationcontext());         llsetwallpaper.setonclicklistener(this);         lldownloadwallpaper.setonclicklistener(this);         llsetwallpaper.getbackground().setalpha(70);         lldownloadwallpaper.getbackground().setalpha(70);         intent = getintent();         selectedphoto = (wallpaper) i.getserializableextra(tag_sel_image);         adrequest adrequest = new adrequest.builder().build();         minterstitialad.loadad(adrequest);         if (selectedphoto != null) {             fetchfullresolutionimage();         } else {             toast.maketext(getapplicationcontext(),                 getstring(r.string.msg_unknown_error), toast.length_short)                 .show();         }     }  private void fetchfullresolutionimage() {     string url = selectedphoto.getphotojson();     pbloader.setvisibility(view.visible);     llsetwallpaper.setvisibility(view.gone);     lldownloadwallpaper.setvisibility(view.gone);     jsonobjectrequest jsonobjreq = new jsonobjectrequest(method.get, url,             null, new response.listener<jsonobject>() {                 @override                 public void onresponse(jsonobject response) {                     log.d(tag,                             "image full resolution json: "                                     + response.tostring());                     try {                         jsonobject entry = response                                 .getjsonobject(tag_entry);                          jsonarray mediacontentarry = entry.getjsonobject(                                 tag_media_group).getjsonarray(                                 tag_media_content);                          jsonobject mediaobj = (jsonobject) mediacontentarry                                 .get(0);                          string fullresolutionurl = mediaobj                                 .getstring(tag_img_url);                         final int width = mediaobj.getint(tag_img_width);                         final int height = mediaobj.getint(tag_img_height);                          log.d(tag, "full resolution image. url: "                                 + fullresolutionurl + ", w: " + width                                 + ", h: " + height);                          imageloader imageloader = appcontroller                                 .getinstance().getimageloader();                         imageloader.get(fullresolutionurl,                                 new imagelistener() {                                     @override                                     public void onerrorresponse(                                             volleyerror arg0) {                                         toast.maketext(                                                 getapplicationcontext(),                                                 getstring(r.string.msg_wall_fetch_error),                                                 toast.length_long).show();                                     }                                      @override                                     public void onresponse(                                             imagecontainer response,                                             boolean arg1) {                                         if (response.getbitmap() != null) {                                             // load bitmap imageview                                             fullimageview                                                     .setimagebitmap(response                                                             .getbitmap());                                             adjustimageaspect(width, height);                                              // hide loader , show set &                                             // download buttons                                             pbloader.setvisibility(view.gone);                                             llsetwallpaper                                                     .setvisibility(view.visible);                                             lldownloadwallpaper                                                     .setvisibility(view.visible);                                         }                                     }                                 });                      } catch (jsonexception e) {                         e.printstacktrace();                         toast.maketext(getapplicationcontext(),                                 getstring(r.string.msg_unknown_error),                                 toast.length_long).show();                     }                  }             }, new response.errorlistener() {                  @override                 public void onerrorresponse(volleyerror error) {                     log.e(tag, "error: " + error.getmessage());                     // unable fetch wallpapers                     // either google username wrong or                     // devices doesn't have internet connection                     toast.maketext(getapplicationcontext(),                             getstring(r.string.msg_wall_fetch_error),                             toast.length_long).show();                  }             });      // remove url cache     appcontroller.getinstance().getrequestqueue().getcache().remove(url);      // disable cache url, fetches updated     // json     jsonobjreq.setshouldcache(false);      // adding request request queue     appcontroller.getinstance().addtorequestqueue(jsonobjreq); }  /**  * adjusting image aspect ration scroll horizontally, image height  * screen height, width calculated respected height  * */ @suppresswarnings("deprecation") @suppresslint("newapi") private void adjustimageaspect(int bwidth, int bheight) {     linearlayout.layoutparams params = new linearlayout.layoutparams(             layoutparams.match_parent, layoutparams.match_parent);      if (bwidth == 0 || bheight == 0)         return;      int sheight = 0;      if (android.os.build.version.sdk_int >= 13) {         display display = getwindowmanager().getdefaultdisplay();         point size = new point();         display.getsize(size);         sheight = size.y;     } else {         display display = getwindowmanager().getdefaultdisplay();         sheight = display.getheight();     }      int new_width = (int) math.floor((double) bwidth * (double) sheight             / (double) bheight);     params.width = new_width;     params.height = sheight;      log.d(tag, "fullscreen image new dimensions: w = " + new_width             + ", h = " + sheight);      fullimageview.setlayoutparams(params); }  /**  * view click listener  * */ @override public void onclick(view v) {       bitmap bitmap = ((bitmapdrawable) fullimageview.getdrawable())             .getbitmap();     switch (v.getid()) {     // button download wallpaper tapped     case r.id.lldownloadwallpaper:         utils.saveimagetosdcard(bitmap);         break;     // button set wallpaper tapped     case r.id.llsetwallpaper:         utils.setaswallpaper(bitmap);         break;     default:         break;     }  }  } 

the layout

<?xml version="1.0" encoding="utf-8"?> <relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" >  <progressbar     android:id="@+id/pbloader"     style="?android:attr/progressbarstyle"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerinparent="true" > </progressbar>   <horizontalscrollview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:scrollbars="none" >      <linearlayout         android:layout_width="wrap_content"         android:layout_height="match_parent" >          <imageview             android:id="@+id/imgfullscreen"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:scaletype="fitxy" />          <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>      </linearlayout> </horizontalscrollview>    <linearlayout     android:id="@+id/llsetwallpaper"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_alignparentleft="true"     android:layout_marginbottom="10dp"     android:layout_marginleft="10dp"     android:background="@drawable/btn_rounded_corner"     android:gravity="center_vertical"     android:orientation="horizontal" >      <imageview         android:layout_width="25dp"         android:layout_height="25dp"         android:src="@drawable/ico_apply" />      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:paddingleft="10dp"         android:text="@string/set_wallpaper"         android:textcolor="@color/white"         android:textsize="18dp" /> </linearlayout>    <linearlayout     android:id="@+id/lldownloadwallpaper"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_alignparentright="true"     android:layout_marginbottom="10dp"     android:layout_marginright="10dp"     android:background="@drawable/btn_rounded_corner"     android:gravity="center_vertical"     android:orientation="horizontal" >      <imageview         android:layout_width="25dp"         android:layout_height="25dp"         android:src="@drawable/ico_download" />      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:paddingleft="10dp"                                       android:text="@string/download_wallpaper"         android:textcolor="@color/white"         android:textsize="18dp" />  </linearlayout> </relativelayout> 

my log

07-13 22:08:21.150: e/dalvikvm(30292): not find class 'android.app.appopsmanager', referenced method   com.google.android.gms.common.googleplayservicesutil.zza 07-13 22:08:21.175: e/androidruntime(30292): fatal exception: main 07-13 22:08:21.175: e/androidruntime(30292): java.lang.runtimeexception: unable start activity componentinfo{info.androidhive.awesomewallpapers/com.infinityapp.olbuzz.fullscreenviewactivity}: java.lang.illegalstateexception: required meta-data tag in app's androidmanifest.xml not exist.  must have following declaration within <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2306) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2358) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activitythread.access$600(activitythread.java:156) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activitythread$h.handlemessage(activitythread.java:1340) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.os.handler.dispatchmessage(handler.java:99) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.os.looper.loop(looper.java:153) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activitythread.main(activitythread.java:5299) 07-13 22:08:21.175: e/androidruntime(30292):    @ java.lang.reflect.method.invokenative(native method) 07-13 22:08:21.175: e/androidruntime(30292):    @ java.lang.reflect.method.invoke(method.java:511) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:833) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 07-13 22:08:21.175: e/androidruntime(30292):    @ de.robv.android.xposed.xposedbridge.main(xposedbridge.java:132) 07-13 22:08:21.175: e/androidruntime(30292):    @ dalvik.system.nativestart.main(native method) 07-13 22:08:21.175: e/androidruntime(30292): caused by: java.lang.illegalstateexception: required meta-data tag in app's androidmanifest.xml not exist.  must have following declaration within <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.common.googleplayservicesutil.zzaa(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.common.googleplayservicesutil.isgoogleplayservicesavailable(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.ads.internal.util.client.zza.zzp(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.ads.internal.client.zze.zza(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.ads.internal.client.zzy.zzco(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.ads.internal.client.zzy.zza(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.google.android.gms.ads.adview.loadad(unknown source) 07-13 22:08:21.175: e/androidruntime(30292):    @ com.infinityapp.olbuzz.fullscreenviewactivity.oncreate(fullscreenviewactivity.java:74) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activity.performcreate(activity.java:5122) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1081) 07-13 22:08:21.175: e/androidruntime(30292):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2270) 

you must have following declaration within element:

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

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -