Failed to allocate a 3112972 byte allocation with 2019776 free bytes and 1972KB until OOM

异常:java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Failed to allocate a 3112972 byte allocation with 2019776 free bytes and 1972KB until OOM

OOM:Android 内存溢出(Java的这个异常是指,内存申请失败,前面那个数字是你想申请分配的内存字节,后面的那个数是实际可用的系统内存,显然小于前者。)

解决方法:在清单文件中添加两行代码:

 android:hardwareAccelerated="false"
 android:largeHeap="true"

eg:

   <application
        android:name=".application.MyShowApplication"
        android:allowBackup="true"
        android:hardwareAccelerated="false"
        android:icon="@mipmap/cat"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
发布了40 篇原创文章 · 获赞 45 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/CGG92/article/details/79125481