我一直在尝试在我的应用程序上添加 adMob,但我无法让它在我的应用程序上运行。最后,我从 adMob 的网站下载了一个示例 adMob 应用程序。但是,这也不起作用。我得到下面的日志:
11-13 18:24:21.477: D/AndroidRuntime(2225): Shutting down VM
11-13 18:24:21.477: W/dalvikvm(2225): threadid=1: thread exiting with uncaught exception (group=0xb40cb180)
11-13 18:24:21.507: E/AndroidRuntime(2225): FATAL EXCEPTION: main
11-13 18:24:21.507: E/AndroidRuntime(2225): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.example.ads.xml/com.google.example.ads.xml.BannerSample}: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.os.Looper.loop(Looper.java:137)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.reflect.Method.invoke(Method.java:511)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-13 18:24:21.507: E/AndroidRuntime(2225): at dalvik.system.NativeStart.main(Native Method)
11-13 18:24:21.507: E/AndroidRuntime(2225): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.Activity.setContentView(Activity.java:1835)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.google.example.ads.xml.BannerSample.onCreate(BannerSample.java:14)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.Activity.performCreate(Activity.java:4465)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-13 18:24:21.507: E/AndroidRuntime(2225): ... 11 more
11-13 18:24:21.507: E/AndroidRuntime(2225): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView
11-13 18:24:21.507: E/AndroidRuntime(2225): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-13 18:24:21.507: E/AndroidRuntime(2225): ... 21 more
11-13 18:24:21.798: I/dalvikvm(2225): threadid=3: reacting to signal 3
11-13 18:24:21.808: I/dalvikvm(2225): Wrote stack traces to '/data/anr/traces.txt'
11-13 18:24:22.148: I/dalvikvm(2225): threadid=3: reacting to signal 3
11-13 18:24:22.158: I/dalvikvm(2225): Wrote stack traces to '/data/anr/traces.txt'