android.view.InflateException:二进制XML文件行#83:错误输出类<unknown> </unknown>

时间:2012-10-31 06:21:15

标签: android

问题是我的应用程序在将一些图像添加到资源文件夹之前运行得很好。添加后,它就停止了工作。我检查了每个图像的扩展,但最后,我被卡住但是下面的logcat消息。还有一件事是在大型和普通设备上正常工作但不适用于小型设备。提前致谢。

 10-31 11:18:25.431: E/AndroidRuntime(637): FATAL EXCEPTION: main
10-31 11:18:25.431: E/AndroidRuntime(637): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newdesign/com.example.newdesign.Recipe}: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.os.Looper.loop(Looper.java:137)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.ActivityThread.main(ActivityThread.java:4424)
10-31 11:18:25.431: E/AndroidRuntime(637):  at java.lang.reflect.Method.invokeNative(Native Method)
10-31 11:18:25.431: E/AndroidRuntime(637):  at java.lang.reflect.Method.invoke(Method.java:511)
10-31 11:18:25.431: E/AndroidRuntime(637):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-31 11:18:25.431: E/AndroidRuntime(637):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-31 11:18:25.431: E/AndroidRuntime(637):  at dalvik.system.NativeStart.main(Native Method)
10-31 11:18:25.431: E/AndroidRuntime(637): Caused by: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.createView(LayoutInflater.java:606)
10-31 11:18:25.431: E/AndroidRuntime(637):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-31 11:18:25.431: E/AndroidRuntime(637):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.Activity.setContentView(Activity.java:1835)
10-31 11:18:25.431: E/AndroidRuntime(637):  at com.example.newdesign.Recipe.onCreate(Recipe.java:58)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.Activity.performCreate(Activity.java:4465)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
10-31 11:18:25.431: E/AndroidRuntime(637):  ... 11 more
10-31 11:18:25.431: E/AndroidRuntime(637): Caused by: java.lang.reflect.InvocationTargetException
10-31 11:18:25.431: E/AndroidRuntime(637):  at java.lang.reflect.Constructor.constructNative(Native Method)
10-31 11:18:25.431: E/AndroidRuntime(637):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.LayoutInflater.createView(LayoutInflater.java:586)
10-31 11:18:25.431: E/AndroidRuntime(637):  ... 24 more
10-31 11:18:25.431: E/AndroidRuntime(637): Caused by: java.lang.OutOfMemoryError
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:483)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.content.res.Resources.loadDrawable(Resources.java:1935)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.View.<init>(View.java:2785)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.View.<init>(View.java:2722)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.view.ViewGroup.<init>(ViewGroup.java:379)
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:174)
10-31 11:18:25.431: E/AndroidRuntime(637):  ... 27 more

1 个答案:

答案 0 :(得分:3)

从这些方面判断

Caused by: java.lang.OutOfMemoryError
10-31 11:18:25.431: E/AndroidRuntime(637):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)

它看起来你在某个地方有一个太大的位图(可能在资源中)