应用程序在我运行时强行关闭?无法开始活动?

时间:2012-02-29 18:03:38

标签: android logcat

当我跑步时,我会立即关闭力量。我永远无法理解logcat错误。我正在使用Eclipse和Android SDK。这是Logcat错误,但它是什么意思?

02-29 12:59:35.875: E/AndroidRuntime(9759): FATAL EXCEPTION: main
02-29 12:59:35.875: E/AndroidRuntime(9759): java.lang.RuntimeException: Unable to start activity ComponentInfo{izzy.n/izzy.n.IzzynActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.os.Looper.loop(Looper.java:130)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.app.ActivityThread.main(ActivityThread.java:3687)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at java.lang.reflect.Method.invokeNative(Native Method)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at java.lang.reflect.Method.invoke(Method.java:507)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at dalvik.system.NativeStart.main(Native Method)
02-29 12:59:35.875: E/AndroidRuntime(9759): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:684)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
02-29 12:59:35.875: E/AndroidRuntime(9759):     at android.view.Layout
02-29 12:59:43.347: I/Process(9759): Sending signal. PID: 9759 SIG: 9

感谢帮助人

,这是xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <include
        android:id="@+id/include1"
        android:layout_width="160dp"
        android:layout_height="200dp"
        android:layout_marginRight="15dp"
        android:layout_marginTop="280dp"
        layout="@layout/main" />




 <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="69dp"
        android:text="@string/button1" />

</RelativeLayout>

这是Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="izzy.n"
    android:versionCode="1"
    android:versionName="1.0" >

     <uses-sdk android:minSdkVersion="10" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="izzy.n.IzzynActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="izzy.n.notes"
            android:label="@string/notes"></activity>
    </application>

</manifest>

1 个答案:

答案 0 :(得分:1)

XML文件的文件名是什么?

    <include
    android:id="@+id/include1"
    android:layout_width="160dp"
    android:layout_height="200dp"
    android:layout_marginRight="15dp"
    android:layout_marginTop="280dp"
    layout="@layout/main" />

包含布局main。如果此文件位于此文件main.xml中,那就是您的问题。如果不是,你可以发布你的onCreate方法,这样我们就可以看到你如何夸大这个观点了吗?

这是一个问题,因为<include/>标记会将布局扩展到当前布局。如果您尝试将@layout/main扩展为@layout/main,则会导致无限递归并且无效。我不确定你要做什么,你想尝试两次绘制相同的布局吗?如果是这样,请尝试创建main_component.xml布局,并使用<include/>中的main.xml来扩充该布局。