0

我正在使用处理在我的设备上运行一个 android 应用程序。但我得到这个错误:

      FATAL EXCEPTION: Animation Thread
      java.lang.OutOfMemoryError

      at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:592)
      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:691)
      at processing.core.PApplet.loadImage(Unknown Source)
          at processing.test.djtubedesktop.DJTubeDesktop.loadImages(DJTubeDesktop.java:972)
      at processing.test.djtubedesktop.DJTubeDesktop.setup(DJTubeDesktop.java:62)
      at processing.core.PApplet.handleDraw(Unknown Source)
      at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
      at processing.core.PApplet.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:856)

我试过这个:1)转到文件->首选项,然后选择“然后将最大可用内存增加到”10240 MB 2)减少帧数。我有这 2 行代码:

       images = loadImages("Animation_data/movie", ".jpg", 134);
       recordPlayer = loadImages("black-record_", ".png", 36);

我已将 134 和 36 替换为 50 和 10,通过这样做我没有收到错误,但它仍然无法正常工作

程序在java上完美运行

我需要在我的安卓设备上运行它

4

2 回答 2

1

The image you are manipulating is too large for Android. You are running out of Bitmap memory Try making the image smaller. You might want to check this link.

于 2013-11-13T04:53:56.190 回答
0

内存不足异常:-

这是因为图像大小很重。尝试使用此代码。

Bitmap bitmapimagesize = Bitmap.createScaledBitmap(your bitmap,
                        yourbitmap.getWidth() / 5, yourbitmap.getHeight() / 5,
                        false);

或这个:

BitmapFactory.Options options = new BitmapFactory.Options();
            options.inSampleSize = 5;
            bitmap = BitmapFactory.decodeFile(image_path, options);
于 2013-11-13T05:18:18.773 回答