小编use*_*173的帖子

内存不足异常+分析hprof文件转储

这与这个问题有关

android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)中的java.lang.OutOfMemoryError

我创建了有问题的转储文件..它提供了以下信息

One instance of "byte[]" loaded by "<system class loader>" occupies 1,10,59,216
(51.02%) bytes. The memory is accumulated in one instance of "byte[]" 
 loaded by "<system class loader>".

Keywords byte[]
Run Code Online (Sandbox Code Playgroud)

那么现在可以做些什么?我该如何清除问题?

我的list_objects [context] - 入站文件

CLASS NAME                                                                 SHALLOW HEAP   RETAINED HEAP  
byte[11059200] @ 0xb4979590                                               |  1,10,59,216 |   1,10,59,216
mBuffer android.graphics.Bitmap @ 0xb3dc68d8                              |48            | 48
mBitmap android.graphics.drawable.BitmapDrawable @ 0xb3dbba60             | 72           | 144
mBackground android.widget.RelativeLayout @ 0xb3db3fc0                    |512           | 10,144
mBitmap android.graphics.drawable.BitmapDrawable$BitmapState @ 0xb3dc0068 |40          | 40 …
Run Code Online (Sandbox Code Playgroud)

java android heap-memory out-of-memory

10
推荐指数
1
解决办法
1545
查看次数

android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)中的java.lang.OutOfMemoryError

我试图按下按钮执行动画..按钮单击步骤如下..

  1. 按钮图像发生变化
  2. 动画播放
  3. 显示下一个布局..

但我得到一个内存不足的例外..

当动画文件未添加到项目时没有错误.但是,由于动漫的加入存在问题.

我在这里使用3个类文件(home_screen,button_anime和home)

home_screen.java接收按钮点击信息,更改按钮图像并转移到button_anime类,动画文件在button_anime.java中启动,动画播放后,下一个布局从home.java显示

原木猫如下..

 E/AndroidRuntime(1255): java.lang.OutOfMemoryError
 E/AndroidRuntime(1255):    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
 E/AndroidRuntime(1255):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
 E/AndroidRuntime(1255):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422)
 E/AndroidRuntime(1255):    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
 E/AndroidRuntime(1255):    at android.content.res.Resources.loadDrawable(Resources.java:2110)
 E/AndroidRuntime(1255):    at android.content.res.Resources.getDrawable(Resources.java:700)
 E/AndroidRuntime(1255):    at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:282)
 E/AndroidRuntime(1255):    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
 E/AndroidRuntime(1255):    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
 E/AndroidRuntime(1255):    at android.content.res.Resources.loadDrawable(Resources.java:2092)
 E/AndroidRuntime(1255):    at android.content.res.Resources.getDrawable(Resources.java:700)
 E/AndroidRuntime(1255):    at android.view.View.setBackgroundResource(View.java:15303)
 E/AndroidRuntime(1255):    at com.quinoid.thomasinternational.Button_Anime.onCreate(Button_Anime.java:19)
 E/AndroidRuntime(1255):    at android.app.Activity.performCreate(Activity.java:5231)
 E/AndroidRuntime(1255):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
 E/AndroidRuntime(1255):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
 E/AndroidRuntime(1255):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
 E/AndroidRuntime(1255):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
 E/AndroidRuntime(1255):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
 E/AndroidRuntime(1255):    at android.os.Handler.dispatchMessage(Handler.java:102)
 E/AndroidRuntime(1255):    at android.os.Looper.loop(Looper.java:136)
 E/AndroidRuntime(1255):    at android.app.ActivityThread.main(ActivityThread.java:5017)
 E/AndroidRuntime(1255):    at …
Run Code Online (Sandbox Code Playgroud)

java animation android out-of-memory

5
推荐指数
2
解决办法
8995
查看次数

标签 统计

android ×2

java ×2

out-of-memory ×2

animation ×1

heap-memory ×1