简体   繁体   中英

Android application Error Opening Trace File: No such file or directory

Here is a link to a question i posted before with my code:

https://stackoverflow.com/questions/22277864/grid-view-open-one-layout-form-another-causes-the-prograam-to-crash

The error happens right as I click on the button2 'Ornaments' on the main form .

Log Cat:

03-09 10:08:20.308: E/Trace(640): error opening trace file: No such file or directory (2)
03-09 10:08:21.158: D/libEGL(640): loaded /system/lib/egl/libEGL_emulation.so
03-09 10:08:21.158: D/(640): HostConnection::get() New Host Connection established 0x2a072918, tid 640
03-09 10:08:21.218: D/libEGL(640): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-09 10:08:21.229: D/libEGL(640): loaded /system/lib/egl/libGLESv2_emulation.so
03-09 10:08:21.338: W/EGL_emulation(640): eglSurfaceAttrib not implemented
03-09 10:08:21.378: D/OpenGLRenderer(640): Enabling debug mode 0
03-09 10:08:26.648: D/dalvikvm(640): GC_FOR_ALLOC freed 125K, 3% free 8250K/8455K, paused 118ms, total 130ms
03-09 10:08:26.648: I/dalvikvm-heap(640): Forcing collection of SoftReferences for 31961104-byte allocation
03-09 10:08:26.838: D/dalvikvm(640): GC_BEFORE_OOM freed 13K, 3% free 8236K/8455K, paused 184ms, total 185ms
03-09 10:08:26.838: E/dalvikvm-heap(640): Out of memory on a 31961104-byte allocation.
03-09 10:08:26.838: I/dalvikvm(640): "main" prio=5 tid=1 RUNNABLE
03-09 10:08:26.848: I/dalvikvm(640):   | group="main" sCount=0 dsCount=0 obj=0x40a14568 self=0x2a00b9e0
03-09 10:08:26.848: I/dalvikvm(640):   | sysTid=640 nice=0 sched=0/0 cgrp=apps handle=1073870640
03-09 10:08:26.848: I/dalvikvm(640):   | schedstat=( 1310216641 1726854966 299 ) utm=92 stm=39 core=0
03-09 10:08:26.858: I/dalvikvm(640):   at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-09 10:08:26.858: I/dalvikvm(640):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-09 10:08:26.858: I/dalvikvm(640):   at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-09 10:08:26.873: I/dalvikvm(640):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
03-09 10:08:26.878: I/dalvikvm(640):   at android.content.res.Resources.loadDrawable(Resources.java:1930)
03-09 10:08:26.878: I/dalvikvm(640):   at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-09 10:08:26.878: I/dalvikvm(640):   at android.widget.ImageView.<init>(ImageView.java:120)
03-09 10:08:26.878: I/dalvikvm(640):   at android.widget.ImageView.<init>(ImageView.java:110)
03-09 10:08:26.878: I/dalvikvm(640):   at java.lang.reflect.Constructor.constructNative(Native Method)
03-09 10:08:26.878: I/dalvikvm(640):   at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-09 10:08:26.878: I/dalvikvm(640):   at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-09 10:08:26.888: I/dalvikvm(640):   at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-09 10:08:26.888: I/dalvikvm(640):   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-09 10:08:26.888: I/dalvikvm(640):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-09 10:08:26.888: I/dalvikvm(640):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-09 10:08:26.888: I/dalvikvm(640):   at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-09 10:08:26.888: I/dalvikvm(640):   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-09 10:08:26.898: I/dalvikvm(640):   at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-09 10:08:26.898: I/dalvikvm(640):   at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-09 10:08:26.898: I/dalvikvm(640):   at android.app.Activity.setContentView(Activity.java:1867)
03-09 10:08:26.898: I/dalvikvm(640):   at edu.ajh161.designs.Ornaments.onCreate(Ornaments.java:13)
03-09 10:08:26.898: I/dalvikvm(640):   at android.app.Activity.performCreate(Activity.java:5008)
03-09 10:08:26.910: I/dalvikvm(640):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-09 10:08:26.910: I/dalvikvm(640):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-09 10:08:26.910: I/dalvikvm(640):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-09 10:08:26.910: I/dalvikvm(640):   at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-09 10:08:26.910: I/dalvikvm(640):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-09 10:08:26.910: I/dalvikvm(640):   at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 10:08:26.910: I/dalvikvm(640):   at android.os.Looper.loop(Looper.java:137)
03-09 10:08:26.918: I/dalvikvm(640):   at android.app.ActivityThread.main(ActivityThread.java:4745)
03-09 10:08:26.918: I/dalvikvm(640):   at java.lang.reflect.Method.invokeNative(Native Method)
03-09 10:08:26.918: I/dalvikvm(640):   at java.lang.reflect.Method.invoke(Method.java:511)
03-09 10:08:26.918: I/dalvikvm(640):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-09 10:08:26.918: I/dalvikvm(640):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-09 10:08:26.918: I/dalvikvm(640):   at dalvik.system.NativeStart.main(Native Method)
03-09 10:08:26.928: D/skia(640): --- decoder->decode returned false
03-09 10:08:26.948: D/AndroidRuntime(640): Shutting down VM
03-09 10:08:26.958: W/dalvikvm(640): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-09 10:08:27.138: E/AndroidRuntime(640): FATAL EXCEPTION: main
03-09 10:08:27.138: E/AndroidRuntime(640): java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.ajh161.designs/edu.ajh161.designs.Ornaments}: android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.os.Looper.loop(Looper.java:137)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.ActivityThread.main(ActivityThread.java:4745)
03-09 10:08:27.138: E/AndroidRuntime(640):  at java.lang.reflect.Method.invokeNative(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640):  at java.lang.reflect.Method.invoke(Method.java:511)
03-09 10:08:27.138: E/AndroidRuntime(640):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-09 10:08:27.138: E/AndroidRuntime(640):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-09 10:08:27.138: E/AndroidRuntime(640):  at dalvik.system.NativeStart.main(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640): Caused by: android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-09 10:08:27.138: E/AndroidRuntime(640):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-09 10:08:27.138: E/AndroidRuntime(640):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.Activity.setContentView(Activity.java:1867)
03-09 10:08:27.138: E/AndroidRuntime(640):  at edu.ajh161.designs.Ornaments.onCreate(Ornaments.java:13)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.Activity.performCreate(Activity.java:5008)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-09 10:08:27.138: E/AndroidRuntime(640):  ... 11 more
03-09 10:08:27.138: E/AndroidRuntime(640): Caused by: java.lang.reflect.InvocationTargetException
03-09 10:08:27.138: E/AndroidRuntime(640):  at java.lang.reflect.Constructor.constructNative(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-09 10:08:27.138: E/AndroidRuntime(640):  ... 24 more
03-09 10:08:27.138: E/AndroidRuntime(640): Caused by: java.lang.OutOfMemoryError
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.content.res.Resources.loadDrawable(Resources.java:1930)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.widget.ImageView.<init>(ImageView.java:120)
03-09 10:08:27.138: E/AndroidRuntime(640):  at android.widget.ImageView.<init>(ImageView.java:110)
03-09 10:08:27.138: E/AndroidRuntime(640):  ... 27 more
03-09 10:08:31.238: I/Process(640): Sending signal. PID: 640 SIG: 9

Here, you are getting 3 Exceptions:

android.view.InflateException
java.lang.reflect.InvocationTargetException
java.lang.OutOfMemoryError

The problem starts to occurring from OutOfMemoryError Exception . The drawable , you are trying to set in the ImageView with the id imageview2 , may be too large. So, when system trying to process that drawable it exceeds memory limit...then OutOfMemoryError Exception occurring.

Since, due to the OutOfMemoryError , system can't set that drawable to tha ImageView then its throwing other Exceptions as InvocationTargetException and InflateException .

Now, try to reduce the drawable's size...may be your problem will be solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM