gpt4 book ai didi

picasso 产生OutOfMemoryError

转载 作者:行者123 更新时间:2023-12-04 08:52:12 27 4
gpt4 key购买 nike

我们正在使用Picasso加载应用程序中的所有图像,从小型化身到大型全屏图像,每10个每日事件用户中就会出现1个此类错误。 picasso 缓存已满,但据我们了解,它应该自行维护。

我们的日志表明,在高端设备(Galaxy S4)上加载大全屏图像(1080x1920)和大头像(720x720)时,这些错误最常发生,但在小头像(135x135)上偶尔加载。

com.couchsurfing.mobile.data.PicassoException: Error while loading image with Picasso
at com.couchsurfing.mobile.data.DataModule$1.onImageLoadFailed(DataModule.java:158)
at com.squareup.picasso.Picasso.complete(Picasso.java:374)
at com.squareup.picasso.Picasso$1.handleMessage(Picasso.java:97)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.RuntimeException: ===============BEGIN PICASSO STATS ===============
Memory Cache Stats
Max Cache Size: 19173961
Cache Size: 17988408
Cache % Full: 94
Cache Hits: 228
Cache Misses: 244
Network Stats
Download Count: 131
Total Download Size: 3375735
Average Download Size: 25768
Bitmap Stats
Total Bitmaps Decoded: 206
Total Bitmap Size: 144932008
Total Transformed Bitmaps: 160
Total Transformed Bitmap Size: 40233240
Average Bitmap Size: 703553
Average Transformed Bitmap Size: 195306
===============END PICASSO STATS ===============

at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:117)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeStream(BitmapFactory.java)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623)
at com.squareup.picasso.NetworkBitmapHunter.decodeStream(NetworkBitmapHunter.java:118)
at com.squareup.picasso.NetworkBitmapHunter.decode(NetworkBitmapHunter.java:72)
at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:144)
at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)

最佳答案

我遇到了同样的问题,临时解决方法之一是

<application
...
android:largeHeap="true">

目前,我还没有找到其他解决方案(也许我搜索的不够多)。但是很多人对 picasso 都拥有OOM。

关于 picasso 产生OutOfMemoryError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24270975/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com