安卓内存溢出,APP闪退

2020-12-21  本文已影响0人  可乐_加冰_

报错提示:Failed to allocate a 43848012 byte allocation with 16777216 free bytes and 38MB until OOM........

摘自:https://stackoverflow.com/questions/36652716/java-lang-outofmemoryerror-failed-to-allocate-a-36000012-byte-allocation-with-1

解决方案①

在清单文件 AndroidManifest.xml 文件 application 标签中加入代码

<application
android:largeHeap="true"
android:hardwareAccelerated="false"
>
方案②
如果方案一未能生效,考虑更换项目中引入res/drawable目录下的文件资源(或者图片资源)。将资源移动到res/mipmap-hdpi目录下试试。

即不使用drawable目录存放文件(该目录下存放文件过大,可能导致内存溢出)
上一篇 下一篇

猜你喜欢

热点阅读