0

I am trying to setup ad in my game but I am having a problem. It seems to be crashing. I have included the logcat below and it has something to do with the ad it seems.

06-07 18:49:54.594: E/dalvikvm(308): Could not find class 'com.google.ads.AdView', referenced from method com.blockyblaine.bobhoil.BlockyBlaine.onCreate
06-07 18:49:54.594: W/dalvikvm(308): VFY: unable to resolve check-cast 17 (Lcom/google/ads/AdView;) in Lcom/blockyblaine/bobhoil/BlockyBlaine;
06-07 18:49:54.603: D/dalvikvm(308): VFY: replacing opcode 0x1f at 0x0011
06-07 18:49:54.603: D/dalvikvm(308): VFY: dead code 0x0013-0069 in Lcom/blockyblaine/bobhoil/BlockyBlaine;.onCreate (Landroid/os/Bundle;)V
06-07 18:49:54.933: D/AndroidRuntime(308): Shutting down VM
06-07 18:49:54.933: W/dalvikvm(308): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-07 18:49:55.014: E/AndroidRuntime(308): FATAL EXCEPTION: main
06-07 18:49:55.014: E/AndroidRuntime(308): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blockyblaine.bobhoil/com.blockyblaine.bobhoil.BlockyBlaine}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.os.Looper.loop(Looper.java:123)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-07 18:49:55.014: E/AndroidRuntime(308):  at java.lang.reflect.Method.invokeNative(Native Method)
06-07 18:49:55.014: E/AndroidRuntime(308):  at java.lang.reflect.Method.invoke(Method.java:521)
06-07 18:49:55.014: E/AndroidRuntime(308):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-07 18:49:55.014: E/AndroidRuntime(308):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-07 18:49:55.014: E/AndroidRuntime(308):  at dalvik.system.NativeStart.main(Native Method)
06-07 18:49:55.014: E/AndroidRuntime(308): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-07 18:49:55.014: E/AndroidRuntime(308):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.Activity.setContentView(Activity.java:1647)
06-07 18:49:55.014: E/AndroidRuntime(308):  at com.blockyblaine.bobhoil.BlockyBlaine.onCreate(BlockyBlaine.java:27)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-07 18:49:55.014: E/AndroidRuntime(308):  ... 11 more
06-07 18:49:55.014: E/AndroidRuntime(308): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.blockyblaine.bobhoil-2.apk]
06-07 18:49:55.014: E/AndroidRuntime(308):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
06-07 18:49:55.014: E/AndroidRuntime(308):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
06-07 18:49:55.014: E/AndroidRuntime(308):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.createView(LayoutInflater.java:466)
06-07 18:49:55.014: E/AndroidRuntime(308):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
06-07 18:49:55.014: E/AndroidRuntime(308):  ... 20 more
06-07 18:50:01.593: I/Process(308): Sending signal. PID: 308 SIG: 9
Greg Froning
  • 213
  • 1
  • 4
  • 16
  • You seem to be missing the AdMobs library, make sure to place it in the _libs_ folder – K-ballo Jun 07 '12 at 18:54
  • 1
    K-ballo's recommendation will work. Alternatively, in Properties -> Java Build Path -> Order and Export, you could export the Google AdMob SDK jar so that it gets included in your apk. – Eric Leichtenschlag Jun 09 '12 at 00:49

1 Answers1

0

This link will take you to the admob developers docs. You will need to be sure to follow the directions to have the admob JAR included in your project.

I found a couple of other mentions related to other google api's. The issue there (giving a similar logcat) was this step was missed:

2. Declare com.google.ads.AdActivity in AndroidManifest.xml.

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

cstrutton
  • 5,667
  • 3
  • 25
  • 32