-1

当我尝试运行我的应用程序时,我收到错误,因为应用程序 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

请帮忙。如何解决

4

2 回答 2

1

您有内存泄漏,Android 操作系统无法创建新布局。- 或大图像。

正是关于这一点,我之前在几个答案中说过。

“原因:java.lang.OutOfMemoryError:位图大小超出 VM 预算”

Android - 在哪里保存全局数据?

如何检测内存泄漏以及如何删除它有多种可能性:

搜索:“解除绑定 Android 组件”

于 2012-12-27T04:08:46.570 回答
1

下面是由一个视图引起的。

  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

Your bitmap size is making it to run out of memory. Check these and try to avoid these. If you still can't get it done on these specific things, you could post your respective code snippets where these errors occur. So that others could edit answers.

于 2012-12-27T04:12:22.067 回答