二进制XML文件行#1:错误膨胀类android.widget.RelativeLayout

时间:2015-03-15 14:58:50

标签: java android xml android-layout

我尝试执行代码但是我失败了。 似乎没有任何compens错误,但我不知道为什么应用程序不起作用。

下面是似乎有问题的xml代码。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/letter_page" >

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView1"
    android:layout_below="@+id/textView1"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="200dp" >
    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="200dp" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:orientation="vertical" >
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="100dp"
            android:gravity="center_horizontal" >

            <Button
                android:id="@+id/lock"
                android:layout_width="50dp"
                android:layout_height="30dp"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/lock_selector"
                android:gravity="center_horizontal" />
        </LinearLayout>

        <Button
            android:id="@+id/led3"
            android:layout_width="50dp"
            android:layout_height="30dp"
            android:layout_alignBaseline="@+id/led1"
            android:layout_alignBottom="@+id/led1"
            android:layout_toRightOf="@+id/led2"
            android:background="@drawable/led_selector" />

        <Button
            android:id="@+id/led2"
            android:layout_width="50dp"
            android:layout_height="30dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:background="@drawable/led_selector"
            android:gravity="center" />

        <Button
            android:id="@+id/led1"
            android:layout_width="50dp"
            android:layout_height="30dp"
            android:layout_below="@+id/led2"
            android:layout_toLeftOf="@+id/led2"
            android:background="@drawable/led_selector" />

    </RelativeLayout>

</LinearLayout>

这是LogCat。 我可以看到类似“63996016字节分配的内存不足”。 我是否应该减小我正在使用的png的大小?

如果您能找到除此之外的任何其他错误,请告诉我们。 我对android很新,无法弄清楚这个问题。 提前谢谢!

03-15 23:27:13.550: E/SELinux(21313): Function: selinux_android_load_priority [0], There is no sepolicy file 
03-15 23:27:13.550: E/SELinux(21313):  
03-15 23:27:13.550: E/SELinux(21313): Function: selinux_android_load_priority , loading version is VE=SEPF_SHV-E330S_4.3_0033
03-15 23:27:13.550: E/SELinux(21313):  
03-15 23:27:13.550: E/SELinux(21313):  
03-15 23:27:13.550: E/SELinux(21313): selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts
03-15 23:27:13.550: D/dalvikvm(21313): Late-enabling CheckJNI
03-15 23:27:13.770: D/dalvikvm(21313): GC_FOR_ALLOC freed 103K, 45% free 14538K/26000K, paused 14ms, total 14ms
03-15 23:27:13.790: I/dalvikvm-heap(21313): Grow heap (frag case) to 36.805MB for 18198772-byte allocation
03-15 23:27:13.890: D/dalvikvm(21313): GC_FOR_ALLOC freed <1K, 27% free 32309K/43776K, paused 8ms, total 8ms
03-15 23:27:13.960: I/dalvikvm-heap(21313): Grow heap (frag case) to 75.867MB for 40960016-byte allocation
03-15 23:27:14.140: D/dalvikvm(21313): GC_FOR_ALLOC freed 17792K, 35% free 54632K/83780K, paused 8ms, total 8ms
03-15 23:27:14.140: I/dalvikvm-heap(21313): Forcing collection of SoftReferences for 63996016-byte allocation
03-15 23:27:14.150: D/dalvikvm(21313): GC_BEFORE_OOM freed 9K, 35% free 54622K/83780K, paused 17ms, total 17ms
03-15 23:27:14.150: E/dalvikvm-heap(21313): Out of memory on a 63996016-byte allocation.
03-15 23:27:14.150: I/dalvikvm(21313): "main" prio=5 tid=1 RUNNABLE
03-15 23:27:14.150: I/dalvikvm(21313):   | group="main" sCount=0 dsCount=0 obj=0x41915710 self=0x418f6ca0
03-15 23:27:14.150: I/dalvikvm(21313):   | sysTid=21313 nice=0 sched=0/0 cgrp=apps handle=1074163708
03-15 23:27:14.150: I/dalvikvm(21313):   | state=R schedstat=( 312655954 128263993 1141 ) utm=22 stm=9 core=1
03-15 23:27:14.150: I/dalvikvm(21313):   at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-15 23:27:14.150: I/dalvikvm(21313):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
03-15 23:27:14.150: I/dalvikvm(21313):   at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
03-15 23:27:14.150: I/dalvikvm(21313):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:832)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.content.res.Resources.loadDrawable(Resources.java:2988)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.View.<init>(View.java:3563)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.View.<init>(View.java:3492)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.ViewGroup.<init>(ViewGroup.java:469)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.widget.RelativeLayout.<init>(RelativeLayout.java:242)
03-15 23:27:14.160: I/dalvikvm(21313):   at java.lang.reflect.Constructor.constructNative(Native Method)
03-15 23:27:14.160: I/dalvikvm(21313):   at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.LayoutInflater.createView(LayoutInflater.java:600)
03-15 23:27:14.160: I/dalvikvm(21313):   at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
03-15 23:27:14.160: I/dalvikvm(21313):   at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.Activity.setContentView(Activity.java:1956)
03-15 23:27:14.160: I/dalvikvm(21313):   at com.example.androidarduino.AndroidArduino.onCreate(AndroidArduino.java:34)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.Activity.performCreate(Activity.java:5372)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.ActivityThread.access$700(ActivityThread.java:159)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.os.Handler.dispatchMessage(Handler.java:99)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.os.Looper.loop(Looper.java:137)
03-15 23:27:14.160: I/dalvikvm(21313):   at android.app.ActivityThread.main(ActivityThread.java:5419)
03-15 23:27:14.160: I/dalvikvm(21313):   at java.lang.reflect.Method.invokeNative(Native Method)
03-15 23:27:14.160: I/dalvikvm(21313):   at java.lang.reflect.Method.invoke(Method.java:525)
03-15 23:27:14.160: I/dalvikvm(21313):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
03-15 23:27:14.160: I/dalvikvm(21313):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
03-15 23:27:14.160: I/dalvikvm(21313):   at dalvik.system.NativeStart.main(Native Method)
03-15 23:27:14.160: D/skia(21313): --- decoder->decode returned false
03-15 23:27:14.160: D/AndroidRuntime(21313): Shutting down VM
03-15 23:27:14.160: W/dalvikvm(21313): threadid=1: thread exiting with uncaught exception (group=0x41914898)
03-15 23:27:14.160: E/AndroidRuntime(21313): FATAL EXCEPTION: main
03-15 23:27:14.160: E/AndroidRuntime(21313): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidarduino/com.example.androidarduino.AndroidArduino}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.ActivityThread.access$700(ActivityThread.java:159)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.os.Looper.loop(Looper.java:137)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.ActivityThread.main(ActivityThread.java:5419)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at java.lang.reflect.Method.invokeNative(Native Method)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at java.lang.reflect.Method.invoke(Method.java:525)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at dalvik.system.NativeStart.main(Native Method)
03-15 23:27:14.160: E/AndroidRuntime(21313): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.createView(LayoutInflater.java:626)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.Activity.setContentView(Activity.java:1956)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at com.example.androidarduino.AndroidArduino.onCreate(AndroidArduino.java:34)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.Activity.performCreate(Activity.java:5372)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
03-15 23:27:14.160: E/AndroidRuntime(21313):    ... 11 more
03-15 23:27:14.160: E/AndroidRuntime(21313): Caused by: java.lang.reflect.InvocationTargetException
03-15 23:27:14.160: E/AndroidRuntime(21313):    at java.lang.reflect.Constructor.constructNative(Native Method)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.LayoutInflater.createView(LayoutInflater.java:600)
03-15 23:27:14.160: E/AndroidRuntime(21313):    ... 23 more
03-15 23:27:14.160: E/AndroidRuntime(21313): Caused by: java.lang.OutOfMemoryError
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:832)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.content.res.Resources.loadDrawable(Resources.java:2988)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.View.<init>(View.java:3563)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.View.<init>(View.java:3492)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.view.ViewGroup.<init>(ViewGroup.java:469)
03-15 23:27:14.160: E/AndroidRuntime(21313):    at android.widget.RelativeLayout.<init>(RelativeLayout.java:242)
03-15 23:27:14.160: E/AndroidRuntime(21313):    ... 26 more
03-15 23:27:41.670: I/Process(21313): Sending signal. PID: 21313 SIG: 9

0 个答案:

没有答案