简体   繁体   中英

Android App crashing on some devices like Samsung when scrolling through recyclerview

I am currently developing an android app which has images loaded from the app into a recyclerview. The application is working on some devices but I noticed that on my Samsung Galaxy S5, the app keeps crashing when I scroll through the recyclerview . I need help

OutOfMemoryError is a common error and often occurs in cases when dealing with bitmaps. This occurs due to lack of memory which can't be allocated. In order to resolve this, please implement the following in your tag within the manifest file.
Remember to include this in the activity that's throwing the error so in this case it's the activity with recyclerview.

android:hardwareAccerlerated="false"
android:largeHeap="true"

Hopefully you should be able to resolve the issue with these attributes.

Any questions, let me know.

I found at after searching that , though the images had smaller sizes, the dimensions were large. What I finally did was using imagemagic to resize all the images to 50% their initial sizes and everything works perfectly now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM