解决:java.lang.OutOfMemoryError: Failed to allocate a 2198284 byte allocation with 191616 free bytes
或:java.lang.OutOfMemoryError: Failed to allocate a 20971532 byte allocation with 4194304 free bytes and 7MB until OOM
说明:在列表中上拉加载很多数据的时候出现的,由于列表中的控件有一个自定义的圆形头像图片导致的
<application
android:name=".im.ImApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:largeHeap="true"
android:hardwareAccelerated="false"
android:theme="@style/AppTheme">
需要在清单文件的application中加上下面两行代码:
android:largeHeap="true"
android:hardwareAccelerated="false"