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"
如下:
1
2
3
4
5
6
7
8
<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">

 

posted on   迷途行者  阅读(5361)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示