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

时间:2019-09-02 22:15:26   收藏:0   阅读:1590

错误代码:

  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">

 

原文:https://www.cnblogs.com/hahayixiao/p/11364542.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!