本文介绍了java.lang.OutOfMemoryError在Android 4.0(API 14)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,在模拟器行之有效的Andr​​oid 2.2系统,2.3.1和放大器; 2.3.3。但是,当我测试它在Android 4.0,它给这个错误:

I have an Android app that works well in the emulators for Android 2.2, 2.3.1 & 2.3.3. But when I test it out on Android 4.0, it gives this error:

Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo
…
…
Caused by: java.view.InflateException
…
…
Caused by: java.lang.reflect.InvocationTargetException
…
…
Caused by: java.lang.OutOfMemoryError

它发生每次我试着去下一个活动! (我用的是 TabActivity 其中有在其中3项活动)。

It occurs everytime I try to go the next activity! (I use a TabActivity which has 3 activities within it).

我不知道是什么的API已经改变14.请指点。

I am not sure what has changed in API 14. Please advice.

推荐答案

检查所用的AVD最大虚拟机应用程序堆大小参数的值。安卓3.X AVD默认使用48 MB,所以它应该至少不低于为Android 4.0。
我找不到的Galaxy S II与堆大小的信息规范包括在内,但我建议你去尝试48或64 MB。

Check the value of the "Max VM application heap size" parameter in the AVD you use. Android 3.x AVD uses by default 48 Mb, so it should be at least not less for Android 4.0.
I couldn't find the specification of Galaxy S II with heap size info included, but I suggest you to try 48 or 64 Mb.

这篇关于java.lang.OutOfMemoryError在Android 4.0(API 14)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 14:57