应用程序意外停止了eclipse仿真器?

时间:2013-12-22 12:12:04

标签: android eclipse

我在Android模拟器中测试了我的应用程序,每当我运行它调试它时它就会崩溃。清单文件以核心方式处理活动,但仍然崩溃。

这是catlog:

12-22 11:20:57.942: D/AndroidRuntime(256): Shutting down VM
12-22 11:20:57.942: W/dalvikvm(256): threadid=1: thread exiting with uncaught exception       (group=0x4001d800)
12-22 11:20:57.962: E/AndroidRuntime(256): FATAL EXCEPTION: main
12-22 11:20:57.962: E/AndroidRuntime(256): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.domaceserije.tesladev/org.domaceserije.tesladev.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.google.ads.AdView
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.os.Looper.loop(Looper.java:123)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.ActivityThread.main(ActivityThread.java:4627)
12-22 11:20:57.962: E/AndroidRuntime(256):  at java.lang.reflect.Method.invokeNative(Native Method)
12-22 11:20:57.962: E/AndroidRuntime(256):  at java.lang.reflect.Method.invoke(Method.java:521)
12-22 11:20:57.962: E/AndroidRuntime(256):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-22 11:20:57.962: E/AndroidRuntime(256):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-22 11:20:57.962: E/AndroidRuntime(256):  at dalvik.system.NativeStart.main(Native Method)
12-22 11:20:57.962: E/AndroidRuntime(256): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class com.google.ads.AdView
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-22 11:20:57.962: E/AndroidRuntime(256):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.Activity.setContentView(Activity.java:1647)
12-22 11:20:57.962: E/AndroidRuntime(256):  at org.domaceserije.tesladev.MainActivity.onCreate(MainActivity.java:21)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-22 11:20:57.962: E/AndroidRuntime(256):  ... 11 more
12-22 11:20:57.962: E/AndroidRuntime(256): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/org.domaceserije.tesladev-1.apk]
12-22 11:20:57.962: E/AndroidRuntime(256):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
12-22 11:20:57.962: E/AndroidRuntime(256):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
12-22 11:20:57.962: E/AndroidRuntime(256):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.createView(LayoutInflater.java:466)
12-22 11:20:57.962: E/AndroidRuntime(256):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
12-22 11:20:57.962: E/AndroidRuntime(256):  ... 20 more

编辑:主要活动布局,只有webView和AdView显示在主要活动上。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent" android:id="@+id/rltvLayout1"
    android:layout_height="fill_parent">

        <WebView android:id="@+id/web_engine"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:fitsSystemWindows="true" />



            <com.google.ads.AdView
                android:id="@+id/adView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                ads:adSize="BANNER"
                ads:adUnitId="a1520b6f2adf29f"
                ads:loadAdOnCreate="true"
                ads:refreshInterval="60" >
            </com.google.ads.AdView>

</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

看起来你错过了adView课程。你可能错过了广告小怪罐。我建议你再次阅读他们的tutorial