InflateException for admob's adview after usin

2019-08-01 21:45发布

问题:

I'm new to admob.I use Android froyo and I added Adview to my main.xml as follow:

<com.google.ads.AdView
        xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads"
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        googleads:adSize="BANNER"
        googleads:adUnitId="a14ed7ed1b71bc0" /> 

so when i try to deploy my app using adb everything is ok. But when i use proguard and i install the apk on my phone, app crashes at the begining.

Logcat says:

Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView

So I followed some posts here that says to rename lib app folder to libs but no result. I added

to my manifest app.But no result. Is admpob 4.3.1 compliant with froyo? I really have no idea what is the problem.Please help ciao

回答1:

In proguard manual, some examples are given. There it states

If you're using additional Google APIs, you'll have to specify those as well, for instance:

-libraryjars /usr/local/android-sdk/add-ons/google_apis-7_r01/libs/maps.jar

Try specifying the admob library path this way in proguard config file.

Link to Proguard Manual

Update

Have you added your jar to build path?
See if this helps