我是靠谱客的博主 负责大碗,这篇文章主要介绍Failed to allocate a 8294412 byte allocation with 2103464 free bytes and 2MB until OOM,现在分享给大家,希望可以做个参考。
在请求网络数据或者照片时,数据过大会报错:java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 2103464 free bytes and 2MB until OOM
解决方法:
1.拓展APP的内存,在清单文件中添加 android:largeHeap=“true” 属性
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
**android:largeHeap="true"**
android:theme="@style/AppTheme">
2.尽量减少使用图片图标,用矢量图代替图标图片
3.尽快的释放一些不需要的使用的内存占用
4.保证app没有内存泄漏
我使用的第一种方法
参考此链接
最后
以上就是负责大碗最近收集整理的关于Failed to allocate a 8294412 byte allocation with 2103464 free bytes and 2MB until OOM的全部内容,更多相关Failed内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复