I have a completed app and I tried adding admob.
I got the publisher id and I have added it in manifest file. When I run in the device, the app works fine in all other activities. However, when I move to the activity where the admob ad has been placed, my app crashes, and in logcat it shows the following error:
The major errors shown in the logcat are as follows:
04-06 20:22:30.627: ERROR/AndroidRuntime(2339):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.mnn.image0114/com.menteon.speedimage0114.ResultPage}:
android.view.InflateException: Binary XML file line #8: Error
inflating class com.admob.ads.AdView04-06 20:22:30.627: ERROR/AndroidRuntime(2339): Caused by:
android.view.InflateException: Binary XML file line #8: Error
inflating class com.admob.ads.AdView04-06 20:22:30.627: ERROR/AndroidRuntime(2339): Caused by:
java.lang.ClassNotFoundException: com.admob.ads.AdView in loader
dalvik.system.PathClassLoader@44ccc270
How to fix this error? Please help me.
If you’re using a recent AdMob jar, you need to be using
com.google.ads.AdView. This is certainly the case in Sdk 4.04.Having said that, I didn’t put my AdViews directly into the XML, but used the following code to place the ads inside a LinearLayout within my XML –