Google Admob Update to 4.1.0

Admob

Just a quick note in case anyone else has had problems with the new Admob 4.1.0 SDK for their Android app.  I just updated from 4.0.4, and was having problems.

Adview missing required XML attribute "adSize"

I found this link showing that some changes need to be made from your previously working AdMob setup in your Android app.  The changes aren’t shown in the documentation yet.

Changes:

  1. Remove attrs.xml (or if you need it for your own custom attributes, remove the parts related to AdViews).
  2. Change the namespace in your layout from xmlns:ads=”http://
    schemas.android.com/apk/res/com.your.packagename”
    to xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads

In addition, by adding this

ads:loadAdOnCreate="true"

You can remove this from your code (which I just added to accommodate the previous Google Admob SDK update).  This restores the “just load an ad at startup” functionality that the Admob SDK previously had.

AdView adView = (AdView)this.findViewById(R.id.admob_adview);
 if(null != adView) {
     adView.loadAd(new AdRequest());
 }

And just like that, I’m using the new AdMob SDK and am getting ads again in my app.  I’m glad this release simplified things a little bit.

As a side note, it might be good to hold onto the previous version of third party libraries until you know the new one works.  You often can’t get the old one after the new one goes online, and you might just be too tired to figure it out right now.  Luckily that wasn’t one of those situations this time.

 

Posted in Android Ad Revenue permalink

About ProjectJourneyman

I am a software engineer that escaped the cubicle world at a large company to go solo with Android app development. My attention to detail and quality applies both to my apps and to my research on how to make money with Android. Now that I have the freedom to work on my own projects, I am documenting my efforts in the hopes that it will help other current or aspiring independent Android developers get the income they desire.

Comments are closed.