0 Replies Latest reply on Jan 4, 2018 6:38 AM by chadmild

    Android: using the css style: object-fit:cover on an img will potentially cause the app to crash, with an out of memory exception.


      This error occurs only in androidl.  It worked fine in ios.


      We have an app that uses the css-style:  object-fit:cover on img's, and ran into a very cryptic out of memory error.


      The part of the app that crashed was an image upload area of the app where there were thumbnails and a larger image to view the selected thumbnail,  I thought at first that the images were too big, so I made the images lower quality, even going so far as to make them a quality of "1" essentially creating a white blob of an image.  Still the memory exceptions continued.


      So I used android studio's debugging tools to view memory usage and all seemed well, I would add one image, and then another, and then all of a sudden, the app would crash and the error that caused the crash was an out of memory exception.  But the memory usage looked fine up to that point.


      After a couple of days of debugging, I finally found the culprit.  It looks like android is not handling object-fit:cover properly, maybe it is loading the image into memory multiple times in order to size the image properly?


      When I removed that css property, the out of memory errors stopped.


      Seems like I stumbled upon either an android bug, where the webView is not handling the css correctly, or a phonegap bug.


      Has anyone else ever had this issue, or know how to fix it?