android - fresco库加载图片出现OOM,求使用过的大神解决
ringa_lee
ringa_lee 2017-04-17 17:52:31
0
14
1511

有没有人使用过fresco库加载图片解决OOM问题的?因为我的项目需要大量加载图片,用了fresco库主要就是想解决GC相关OOM问题,但是发现项目在AS中使用fresco库运行在21安卓版本以下还是会出现OOM问题,运行在21及以上的版本不会出现任何问题,gradle一些相关语句如下:
compileSdkVersion 23
buildToolsVersion '23.0.3'
minSdkVersion 15
targetSdkVersion 23
compile 'com.facebook.fresco:fresco:0.9.0+'
报错图片:

ringa_lee
ringa_lee

ringa_lee

reply all(14)
刘奇

Can I recommend glide
https://github.com/bumptech/g...

迷茫

Use Glide

黄舟

1. Check whether the system has code that uses large memory or an infinite loop.
2. You can add JVM startup parameters to limit memory usage: -XX:-UseGCOverheadLimit

  1. You can add attributes to fresco and change the size of the image

小葫芦

Same recommendation as glide. The code is simple and automatically compresses cached images

In systems below 5.0 (that is, API21), Fresco places images in a special memory area. Of course, when the picture is not displayed, the occupied memory will be automatically released. This will make the APP smoother and reduce OOM caused by image memory usage. It’s written in the fresco Chinese document

And now the latest one is compile 'com.facebook.fresco:fresco:0.13.0', you can try it

伊谢尔伦

First of all, I am here to support you.

I don’t know what those people think about using Glide. Can you even tell me why you use Glide (although I always use glide)

When you encounter a problem, you should solve it. Changing the library is one way, but at least you should try and fail before changing.

I have a question, why does fressco oom? Isn’t it said that it is the most popular in the industry?

Let me tell you my thoughts:
If the poster really takes this library out of OOM, I think it is quite powerful. You might as well check the code to see what is unreasonable. If you think you are right, you might as well send an issue to github

迷茫

I have encountered your problem before when using Fresco. At that time, I suspected that it was a problem with Fresco itself, but later I found that it was a problem with my own code. Under normal circumstances, Fresco itself will not trigger OOM. It is recommended to check your own code first.

Peter_Zhu

同 Glide

巴扎黑

This is the compilation process oom, not the runtime oom, and has nothing to do with what library is used.
The compilation process produces oom, and the compilation parameters need to be adjusted, as @wordplat said

android {

dexOptions {
    javaMaxHeapSize "4g"
}
}
小葫芦

Your problem is actually an OOM generated during code compilation, not a problem caused by the framework itself, so you only need to adjust the size of the JVM heap memory.

dexOptions {
    javaMaxHeapSize "4g"
}
刘奇

Sometimes it’s convenient to post the code

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!