Exception: Binary XML file line #68: Error inflating class com.google.ads.AdView ...Again

2,751 views
Skip to first unread message

Jeremy Freeman

unread,
Feb 21, 2014, 3:29:57 PM2/21/14
to google-adm...@googlegroups.com
It seems that many people have been getting this error, and after digging through all of the posted solutions on both here and stack overflow and finding all of them do not help, I would like to ask again:

I am a first time android developer who is working on an app.  I have all of my functionality working in Eclipse and in the AVD, but when I try to add AdMob ads, I can't get the program to run.  It always fails with the following error:

Binary XML file line #68: Error inflating class com.google.ads.AdView

The offending xml call is:

        <com.google.ads.AdView android:id="@+id/ad"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adUnitId="ca-app-pub-#####################"
        ads:adSize="BANNER" />

I added the google-play-services_lib project from the android resources to eclipse using the proper Import Android code and Android dependencies.  That made everything compile and get me to a deployable apk, but I can't run the project because of the above exception.  I feel like this is a configuration issue, but I don't know where else to look.

the following is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.testappone"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="9" />
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
   
   

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.testappone.MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTask" >
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT"/>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.BROWSABLE"/>
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.VIEW"/>
                <data android:scheme="howsmydriving-oauth-twitter" android:host="callback"/>
            </intent-filter>
        </activity>
       
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <activity android:name="com.google.android.gms.ads.AdActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    </application>

</manifest>

And the following is my project.properties file (with header comments stripped):

# Project target.
target=android-13
android.library.reference.1=../../../../Program Files (x86)/Android/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib


Kunal Verma

unread,
Feb 21, 2014, 3:40:31 PM2/21/14
to Google AdMob Ads Developers
Have you tried AdMob Ads Example project? Example is made to work without any modifications. Just include android version and reference google play services library. Get it from here.

Can't suggest anything without looking at the code, XML and logcat with Ads tag.






--
 
---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Eric Leichtenschlag

unread,
Feb 21, 2014, 6:02:32 PM2/21/14
to google-adm...@googlegroups.com
Hi Jeremy,

In Google Play services, the package names have changed. So your AdView XML call should have the package name com.google.android.gms.AdView.

Please see AdView in XML in Google Play services for more information. It sounds like you were looking at an old sample using the old Android SDK. Also note that the XML namespace for ads in Google Play services is now:
Eric
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.

Jeremy Freeman

unread,
Feb 25, 2014, 1:58:52 PM2/25/14
to google-adm...@googlegroups.com
Perfect - that was exactly what my problem was.

I guess I was following an older guide somewhere with the old namespaces.  Figuring out the namespace changes are the most difficult part of this whole endeavor so far, but I'm glad I have resources to help figure this out!  Thanks!

Thank You,
Jeremy Freeman


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/djfBvPRVzfA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages