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">
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章