2

May be this question is duplicate but its quit strange...

I am working on one application, In which i am using an AdView. Code was in working condition prior to updation. Currently i have updated my sdk to rev 22.0.0 and eclipse also (i think it is giving me error).

I am working on version 2.2 Using GoogleAds.jar (added in libs folder and also in built path).

Also added in Manifest file.

<activity
            android:name="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation"
            android:screenOrientation="landscape" />

this is my add View layout

the folder in which i have added jars is libs. it is giving me error

05-20 19:04:23.476: E/AndroidRuntime(29249): FATAL EXCEPTION: main
05-20 19:04:23.476: E/AndroidRuntime(29249): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abcd/com.abcd.activities.ScheduleActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.ads.AdView
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.os.Looper.loop(Looper.java:130)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.ActivityThread.main(ActivityThread.java:3687)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at java.lang.reflect.Method.invokeNative(Native Method)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at java.lang.reflect.Method.invoke(Method.java:507)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at dalvik.system.NativeStart.main(Native Method)
05-20 19:04:23.476: E/AndroidRuntime(29249): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.ads.AdView
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:684)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.Activity.setContentView(Activity.java:1660)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at com.abcd.activities.ScheduleActivity.onCreate(ScheduleActivity.java:77)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
05-20 19:04:23.476: E/AndroidRuntime(29249):    ... 11 more
05-20 19:04:23.476: E/AndroidRuntime(29249): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.abcd-2.apk]
05-20 19:04:23.476: E/AndroidRuntime(29249):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.createView(LayoutInflater.java:471)
05-20 19:04:23.476: E/AndroidRuntime(29249):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
05-20 19:04:23.476: E/AndroidRuntime(29249):    ... 22 more

i am not getting what i am missing or where i am doing wrong. Please help me for solution.

Thanks in Advance.

Mahaveer Muttha
  • 1,727
  • 4
  • 21
  • 33
  • 1
    I see you are getting a `ClassNotFoundException`, which might be caused by the recent update to ADT 22. Try *[this](http://stackoverflow.com/questions/16608524/eclipse-giving-error-missing-r-java-file-after-recent-update/16608570#16608570)* or *[this](http://stackoverflow.com/questions/16610190/classnotfoundexception-after-adt-update/16610247#16610247)* then. – Krauxe May 20 '13 at 13:56
  • @Krauxe: any solution over it? – Mahaveer Muttha May 20 '13 at 13:59
  • I linked two solutions on my comment above. Try them. – Krauxe May 20 '13 at 14:00

2 Answers2

0

You are using a very old, unsupported, version of the AdMob SDK. You'll want to grab the latest version here. Note that with this version your activity will need to have the following config changes:

<activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

and have target=android-13 or higher in your project.properties.

Eric Leichtenschlag
  • 8,881
  • 1
  • 28
  • 28
0

This problem is generated due to unsupported AdMob sdk version or inappropriate use of Admob sdk.

Following are the steps to resolve this problem.

  1. Download admobsdk latest version of Admob sdk.

  2. Add .jar file of admob sdk in Buildpath of your project (right click on your project=>Build path=>configure build path=>libraries=>add external jars)

  3. Now your problem will resolve certainly.

HRM
  • 2,097
  • 6
  • 23
  • 37