java - Android AdView NoClassDefFoundError -


i'm beginner in android development. released app found glitches, thought of correcting glitches creating new android project same package name of released app. once finished update app, app not running on phone(debugging). says "unfortunately thisapp has stopped." , im trying incorporate admob time.

please me because have publish asap.

here's logcat once app crashes :

08-11 18:14:31.063: e/dalvikvm(15877): not find class 'com.google.ads.adview', referenced method com.gamerspitch.easybluetooth.blueactivity.initadview 08-11 18:14:31.254: e/androidruntime(15877): fatal exception: main 08-11 18:14:31.254: e/androidruntime(15877): java.lang.noclassdeffounderror: com.google.ads.adview 08-11 18:14:31.254: e/androidruntime(15877):    @ com.gamerspitch.easybluetooth.blueactivity.initadview(blueactivity.java:107) 08-11 18:14:31.254: e/androidruntime(15877):    @ com.gamerspitch.easybluetooth.blueactivity.oncreate(blueactivity.java:40) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.activity.performcreate(activity.java:5133) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2175) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2261) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.activitythread.access$600(activitythread.java:141) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.activitythread$h.handlemessage(activitythread.java:1256) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.os.handler.dispatchmessage(handler.java:99) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.os.looper.loop(looper.java:137) 08-11 18:14:31.254: e/androidruntime(15877):    @ android.app.activitythread.main(activitythread.java:5103) 08-11 18:14:31.254: e/androidruntime(15877):    @ java.lang.reflect.method.invokenative(native method) 08-11 18:14:31.254: e/androidruntime(15877):    @ java.lang.reflect.method.invoke(method.java:525) 08-11 18:14:31.254: e/androidruntime(15877):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 08-11 18:14:31.254: e/androidruntime(15877):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 08-11 18:14:31.254: e/androidruntime(15877):    @ dalvik.system.nativestart.main(native method) 

here xml of admob placement. followed this link add admob.

<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" android:background="@drawable/easyb" tools:context=".blueactivity" >  <linearlayout     android:id="@+id/adviewplaceholder"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_alignparentleft="true"     android:orientation="vertical" > </linearlayout>  //other elements 

and i've put in manifest file >

<activity android:name="com.google.ads.adactivity"          android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize" >      </activity> 

and in activity oncreate method >

private adview ad;   @override protected void oncreate(bundle savedinstancestate) {     requestwindowfeature(window.feature_no_title);     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_blue);      initadview(); //other elements protected void initadview() {      ad = new adview(this, adsize.smart_banner, "a15204b9eb97566");      linearlayout ll = (linearlayout)findviewbyid(r.id.adviewplaceholder);      ll.addview(ad);      ad.loadad(new adrequest()); }  protected void destroyadview() {     if(ad != null) ad.destroy(); }  @override protected void ondestroy() {         // destroy ad when activity destroyed     destroyadview();     super.ondestroy(); } 

thanks in advance

according line in error message:

08-11 02:28:56.973: e/androidruntime(27461): java.lang.runtimeexception: unable start activity componentinfo{com.gamerspitch.easybluetooth/com.gamerspitch.easybluetooth.blueactivity}: android.view.inflateexception: binary xml file line #9: error inflating class com.google.ads.adview

there problem adview causes app crash.

could please post .xml layout file activity.

update:

in order make bit more clear. never define adview in .xml. create layout inside layout .xml file has no children, , via code add adview it. looks this:

      private adview ad;        @override       protected void oncreate(bundle savedinstancestate) {           super.oncreate(savedinstancestate);            setcontentview(r.layout.yourlayout);            initadview();            // other code...       }         protected void initadview() {              ad = new adview(this, adsize.smart_banner, "my_ad_unit_id");              linearlayout ll = (linearlayout) findviewbyid(r.id.adviewplaceholder);              ll.addview(ad);              ad.loadad(new adrequest());         }          protected void destroyadview() {             if(ad != null) ad.destroy();         }          @override         protected void ondestroy() {                 // destroy ad when activity destroyed             destroyadview();             super.ondestroy();         } 

and layout yourlayout.xml file:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent >      <!-- lots of other layout stuff here -->       <!-- make adview on bottom of screen -->     <linearlayout         android:id="@+id/adviewplaceholder"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentleft="true"         android:orientation="vertical" >     </linearlayout>  </relativelayout> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -