第一次运行后强制关闭 [英] Force close after first run

查看:177
本文介绍了第一次运行后强制关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做telephon系统的基础上,相关的项目。
它在任何Android的三星集,HTC和摩托罗拉工作正常。
但问题是,当我试图在索尼爱立信Android上运行它设置它得到在每一个时间,即使我打开该应用程序强制关闭。

(第1次我打开它工作得很好,第二次开放,越来越强制关闭....第三次开放,第4次强制关闭......反复应用....)

这是我的logcat

  08-29 16:53:03.346:E / AndroidRuntime(5812):了java.lang.RuntimeException:无法启动活动ComponentInfo {com.excel.extel / com.excel。 extel.ExtelMain}了java.lang.RuntimeException:无法启动活动ComponentInfo {com.excel.extel / com.excel.extel.DialerTab}:android.view.InflateException:二进制XML文件行#83:错误充气类<未知>
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.access $ 1500(ActivityThread.java:121)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:943)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.os.Handler.dispatchMessage(Handler.java:99)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.os.Looper.loop(Looper.java:123)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.main(ActivityThread.java:3701)
08-29 16:53:03.346:E / AndroidRuntime(5812):在java.lang.reflect.Method.invokeNative(本机方法)
08-29 16:53:03.346:E / AndroidRuntime(5812):在java.lang.reflect.Method.invoke(Method.java:507)
08-29 16:53:03.346:E / AndroidRuntime(5812):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:862)
08-29 16:53:03.346:E / AndroidRuntime(5812):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
08-29 16:53:03.346:E / AndroidRuntime(5812):在dalvik.system.NativeStart.main(本机方法)
08-29 16:53:03.346:E / AndroidRuntime(5812):了java.lang.RuntimeException:产生的原因无法启动活动ComponentInfo {com.excel.extel / com.excel.extel.DialerTab}:android.view。 InflateException:二进制XML文件行#83:错误充气类<&不明GT;
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.startActivityNow(ActivityThread.java:1499)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.widget.TabHost $ IntentContentStrategy.getContentView(TabHost.java:676)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.widget.TabHost.setCurrentTab(TabHost.java:348)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.widget.TabHost.addTab(TabHost.java:238)
08-29 16:53:03.346:E / AndroidRuntime(5812):在com.excel.extel.ExtelMain.onCreate(ExtelMain.java:67)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
08-29 16:53:03.346:E / AndroidRuntime(5812):11 ...更多
08-29 16:53:03.346:E / AndroidRuntime(5812):android.view.InflateException:二进制XML文件行#83:由错误造成充气类<&不明GT;
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-29 16:53:03.346:E / AndroidRuntime(5812):在com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-29 16:53:03.346:E / AndroidRuntime(5812):在com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.Activity.setContentView(Activity.java:1657)
08-29 16:53:03.346:E / AndroidRuntime(5812):在com.excel.extel.DialerTab.onCreate(DialerTab.java:139)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
08-29 16:53:03.346:E / AndroidRuntime(5812):20 ...更多
08-29 16:53:03.346:E / AndroidRuntime(5812):因:java.lang.reflect.InvocationTargetException
08-29 16:53:03.346:E / AndroidRuntime(5812):在java.lang.reflect.Constructor.constructNative(本机方法)
08-29 16:53:03.346:E / AndroidRuntime(5812):在java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-29 16:53:03.346:E / AndroidRuntime(5812):32 ...更多
08-29 16:53:03.346:E / AndroidRuntime(5812):java.lang.OutOfMemoryError:产生的原因位图大小超过VM预算
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.graphics.BitmapFactory.nativeDe $ C $检测板(本机方法)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.graphics.BitmapFactory.de codeStream(BitmapFactory.java:460)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.graphics.BitmapFactory.de codeResourceStream(BitmapFactory.java:336)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.content.res.Resources.loadDrawable(Resources.java:1713)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.view.View<&初始化GT;(View.java:1969)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.widget.ImageView<&初始化GT;(ImageView.java:116)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.widget.ImageButton<&初始化GT;(ImageButton.java:85)
08-29 16:53:03.346:E / AndroidRuntime(5812):在android.widget.ImageBu

有人告诉我什么问题?是不是我的错,或者设置的问题?


解决方案

 产生的原因:java.lang.OutOfMemoryError:位图大小超过VM预算

这意味着该设备上场的存储器,它是被强制关闭。

现在,既然你说,在应用程序运行的第一次,但不是从今以后,我相信,你是不是释放资源。位图可有时占用了大量的空间,如果你是在内存坚持他们,如果设备进入OOM我也不会感到惊讶。不同的设备有不同规格的内存,这是它的一些,但不能在其他人运行的原因。

所以,我的建议是清除位图和所使用的临时用途等存储。

如果仍然不能解决你的问题,发布code你在哪里处理图像,我们会尝试看看是否有你在做什么更多的内存高效的方法。

祝你好运!

I made a project related on the base of telephon system. It works fine in any Samsung android set,HTC and Motorola. But the problem is when i tried to run it in Sony Ericsson Android set it's getting force close in every even time i open the application.

(1st time i open the application it works fine,2nd time open,getting force close....3rd time open, 4th time force close... repeated....)

This is my logcat

08-29 16:53:03.346: E/AndroidRuntime(5812): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.excel.extel/com.excel.extel.ExtelMain}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.excel.extel/com.excel.extel.DialerTab}: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.access$1500(ActivityThread.java:121)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.os.Looper.loop(Looper.java:123)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.main(ActivityThread.java:3701)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Method.invokeNative(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Method.invoke(Method.java:507)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at dalvik.system.NativeStart.main(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.excel.extel/com.excel.extel.DialerTab}: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.startActivityNow(ActivityThread.java:1499)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:676)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.TabHost.setCurrentTab(TabHost.java:348)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.TabHost.addTab(TabHost.java:238)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.excel.extel.ExtelMain.onCreate(ExtelMain.java:67)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
08-29 16:53:03.346: E/AndroidRuntime(5812):  ... 11 more
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.Activity.setContentView(Activity.java:1657)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.excel.extel.DialerTab.onCreate(DialerTab.java:139)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
08-29 16:53:03.346: E/AndroidRuntime(5812):  ... 20 more
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: java.lang.reflect.InvocationTargetException
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Constructor.constructNative(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-29 16:53:03.346: E/AndroidRuntime(5812):  ... 32 more
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.content.res.Resources.loadDrawable(Resources.java:1713)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.View.<init>(View.java:1969)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.ImageView.<init>(ImageView.java:116)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.ImageButton.<init>(ImageButton.java:85)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.ImageBu

Anybody tell me whats the problem?Is it my fault or the set's problem?

解决方案

Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

This means that the device has gone out of memory and it is being force closed.

Now, since you say that the application is running for the first time but not henceforth, I believe that you are not freeing the resources. Bitmaps can sometime take up a lot of space and if you are persisting them in the memory, I would not be surprised if the device goes OOM. Different devices have different specs for memory and that is the reason it is running on some but not on others.

So, my suggestion would be to clear the Bitmaps and the other storage that you are using for temporary purposes.

If that still does not solve your problem, post the code where you are handling the images and we will try to see if there is a more memory efficient way of what you are doing.

Good luck!

这篇关于第一次运行后强制关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆