Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
uncommenting //layout.addView(adView); => crash — Gideros Forum

uncommenting //layout.addView(adView); => crash

marcmarc Member
edited February 2014 in General questions
I've tried adding an AdView as the Android docs describe. It compiles, but at runtime it crashes.

As soon as the .apk contains "layout.addView(adView);", it will crash with this logcat:


02-10 12:27:37.817: D/dalvikvm(13002): Added shared lib /data/app-lib/com.somevendor.someapp-1/libjson.so 0x41400710
02-10 12:27:37.817: D/dalvikvm(13002): Trying to load lib /data/app-lib/com.somevendor.someapp-1/libbitop.so 0x41400710
02-10 12:27:37.817: D/dalvikvm(13002): Added shared lib /data/app-lib/com.somevendor.someapp-1/libbitop.so 0x41400710
02-10 12:27:37.856: E/AndroidRuntime(13002): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.somevendor.someapp/com.giderosmobile.android.someappActivity}: java.lang.NullPointerException
02-10 12:27:37.856: E/AndroidRuntime(13002): at com.giderosmobile.android.someappActivity.onCreate(someappActivity.java:70)
02-10 12:27:37.859: W/ActivityManager(439): Force finishing activity com.somevendor.someapp/com.giderosmobile.android.someappActivity
02-10 12:27:37.905: D/AES(439): process : com.somevendor.someapp
02-10 12:27:37.905: D/AES(439): module : com.somevendor.someapp v15 (1.0)
02-10 12:27:37.905: D/AEE/LIBAEE(439): shell: raise_exp(2, 13002, -1361051648, com.somevendor.someapp, 0x0x5be4e938, 0x0x0)
02-10 12:27:38.178: V/WindowManager(439): Changing focus from null to Window{413f1e68 u0 Application Error: com.somevendor.someapp}
02-10 12:27:38.179: I/WindowManager(439): Gaining focus: Window{413f1e68 u0 Application Error: com.somevendor.someapp}
02-10 12:27:38.397: W/ActivityManager(439): Activity pause timeout for ActivityRecord{41691ee8 u0 com.somevendor.someapp/com.giderosmobile.android.someappActivity}


The content of my "res/layout/main.xml" (I tried naming it activity_main.xml too) is:


<?xml version="1.0" encoding="utf-8"?>

Comments

  • You actually don't need any xml layout, you can do something like this in your activity after setContentView call
    FrameLayout layout = (FrameLayout)this.getWindow().getDecorView();
    layout.addView(adView)
  • Oh this looks fancy, thanks a lot! :)
Sign In or Register to comment.