Android報錯:java.lang.OutOfMemoryError: Failed to allocate a 74126220 byte allocation with 4190480 free bytes and 61MB until OOM


錯誤代碼:

  java.lang.OutOfMemoryError: Failed to allocate a 74126220 byte allocation with 4190480 free bytes and 61MB until OOM

錯誤原因:

  內存超了

解決方法:

  1、處理圖片和視頻減少加載量

  2、開啟多個線程,避免所有處理都在主線程中處理

  3、在AndroidManifest.xml文件中的application標簽中添加如下四行代碼就解決問題了

  android:allowBackup="true"   android:supportsRtl="true"   android:largeHeap="true"   android:hardwareAccelerated="false"
如下:
<application
    android:allowBackup="true"
    android:hardwareAccelerated="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM