zzhoujay / RichText

Android平台下的富文本解析器,支持Html和Markdown
MIT License
3.92k stars 560 forks source link

出现OutOfMemoryError问题 #347

Open fangbingran opened 5 years ago

fangbingran commented 5 years ago

用法 RichText.from(imgText).scaleType(ImageHolder.ScaleType.center_inside) .size(ImageHolder.MATCH_PARENT, ImageHolder.WRAP_CONTENT).into(mTvImage); 结果

11-07 14:18:53.061 13875-14050/cn.dlc.shandongyangzongjianshenfang E/RichText: AbstractImageLoader --> onFailure > https://img.alicdn.com/imgextra/i1/2206344356353/O1CN017o2yMo1wnilT34Lz7_!!2206344356353.jpg java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:613) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:589) at com.zzhoujay.richtext.ig.SourceDecode$3.decodeAsBitmap(SourceDecode.java:103) at com.zzhoujay.richtext.ig.SourceDecode$3.decodeAsBitmap(SourceDecode.java:67) at com.zzhoujay.richtext.ig.SourceDecode.decode(SourceDecode.java:130) at com.zzhoujay.richtext.ig.AbstractImageLoader.doLoadImage(AbstractImageLoader.java:222) at com.zzhoujay.richtext.ig.InputStreamImageLoader.run(InputStreamImageLoader.java:39) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) 11-07 14:18:53.421 13875-14047/cn.dlc.shandongyangzongjianshenfang E/dalvikvm-heap: Out of memory on a 4786576-byte allocation. 11-07 14:18:53.421 13875-14047/cn.dlc.shandongyangzongjianshenfang E/RichText: AbstractImageLoader --> onFailure > https://img.alicdn.com/imgextra/i4/2206344356353/O1CN01uwYKWE1wnilObHf01_!!2206344356353.jpg java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:613) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:589) at com.zzhoujay.richtext.ig.SourceDecode$3.decodeAsBitmap(SourceDecode.java:103) at com.zzhoujay.richtext.ig.SourceDecode$3.decodeAsBitmap(SourceDecode.java:67) at com.zzhoujay.richtext.ig.SourceDecode.decode(SourceDecode.java:130) at com.zzhoujay.richtext.ig.AbstractImageLoader.doLoadImage(AbstractImageLoader.java:222) at com.zzhoujay.richtext.ig.InputStreamImageLoader.run(InputStreamImageLoader.java:39) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)