当我试图运行我的应用程序时,我收到错误,因为应用程序SV(process.com.app)意外停止。请再试一次强制关闭错误。 Logcat错误在下面给出
12-27 08:57:05.779: D/dalvikvm(278): GC_EXTERNAL_ALLOC freed 866 objects / 60952 bytes in 87ms
12-27 08:57:07.480: E/dalvikvm-heap(278): 11186176-byte external allocation too large for this process.
12-27 08:57:07.480: E/GraphicsJNI(278): VM won't let us allocate 11186176 bytes
12-27 08:57:07.480: E/dalvikvm-heap(278): 11186176-byte external allocation too large for this process.
12-27 08:57:07.480: E/GraphicsJNI(278): VM won't let us allocate 11186176 bytes
12-27 08:57:07.489: D/AndroidRuntime(278): Shutting down VM
12-27 08:57:07.489: W/dalvikvm(278): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-27 08:57:07.528: E/AndroidRuntime(278): FATAL EXCEPTION: main
12-27 08:57:07.528: E/AndroidRuntime(278): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/com.app.ScreenActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.os.Handler.dispatchMessage(Handler.java:99)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.os.Looper.loop(Looper.java:123)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-27 08:57:07.528: E/AndroidRuntime(278): at java.lang.reflect.Method.invokeNative(Native Method)
12-27 08:57:07.528: E/AndroidRuntime(278): at java.lang.reflect.Method.invoke(Method.java:521)
12-27 08:57:07.528: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-27 08:57:07.528: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-27 08:57:07.528: E/AndroidRuntime(278): at dalvik.system.NativeStart.main(Native Method)
12-27 08:57:07.528: E/AndroidRuntime(278): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
12-27 08:57:07.528: E/AndroidRuntime(278): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-27 08:57:07.528: E/AndroidRuntime(278): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.Activity.setContentView(Activity.java:1647)
12-27 08:57:07.528: E/AndroidRuntime(278): at com.app.ScreenActivity.onCreate(ScreenActivity.java:20)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-27 08:57:07.528: E/AndroidRuntime(278): ... 11 more
12-27 08:57:07.528: E/AndroidRuntime(278): Caused by: java.lang.reflect.InvocationTargetException
12-27 08:57:07.528: E/AndroidRuntime(278): at android.widget.ImageView.<init>(ImageView.java:108)
12-27 08:57:07.528: E/AndroidRuntime(278): at java.lang.reflect.Constructor.constructNative(Native Method)
12-27 08:57:07.528: E/AndroidRuntime(278): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
12-27 08:57:07.528: E/AndroidRuntime(278): ... 22 more
12-27 08:57:07.528: E/AndroidRuntime(278): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.Bitmap.nativeCreate(Native Method)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.content.res.Resources.loadDrawable(Resources.java:1709)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.view.View.<init>(View.java:1885)
12-27 08:57:07.528: E/AndroidRuntime(278): at android.widget.ImageView.<init>(ImageView.java:112)
12-27 08:57:07.528: E/AndroidRuntime(278): ... 26 more
Plrease帮助。如何解决它
答案 0 :(得分:1)
您有内存泄漏,Android操作系统无法创建新的布局。 - 或者是大图像。
关于这一点,我在几个答案前说过。
“引起:java.lang.OutOfMemoryError:位图大小超过VM预算”
Android - where to keep global data?
如何检测内存泄漏以及如何删除内存泄漏是非常可能的:
搜索:“取消绑定Android组件”
答案 1 :(得分:1)
以下内容是由iflating视图引起的。
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
您的位图大小使其内存不足。检查这些并尽量避免这些。如果您仍然无法完成这些特定事情,则可以在发生这些错误的位置发布相应的代码段。所以其他人可以编辑答案。