android - 加载图像和 GIF 时如何修复应用程序崩溃?
问题描述
我想在特定状态下加载 2 个 gif 和 2 个图像(png),但是在加载其中一些后应用程序崩溃了,所以突然关闭了我用 android studio 调试应用程序并遇到内存不足的问题我该怎么做才能解决这个问题?
反应原生版本:0.57.2
平台:Android 开发操作系统:Windows 10
这只是我的渲染代码的一部分
....
<Animated.Image
source={
this.props.nextDone && this.props.selectedOptionId !== null
? gifEndGuage[
this.state.prvSelectionOptionId * 10 +
this.props.selectedOptionId
]
: this.props.selectedOptionId !== null
? pathsGif[
this.state.prvSelectionOptionId * 10 +
this.props.selectedOptionId
]
: this.state.guageImage
}
style={{
width: '100%',
height: '100%',
resizeMode: 'contain',
backgroundColor: 'transparent',
opacity: this.state.gifState
}}
/>
<Animated.Image
source={
this.props.selectedOptionId !== null
? pathsPng[this.props.selectedOptionId]
: this.state.selectedGuagePng
}
style={{
width: '100%',
height: '100%',
resizeMode: 'contain',
backgroundColor: 'transparent',
opacity: this.state.pngState,
position: 'absolute'
}}
/>
....
解决方案
推荐阅读
- java - 用另一个文件中的替换替换文件中定义的单词 - Java
- kubernetes - 当一个节点关闭时,如何减少在另一个节点上移动 pod 的时间
- autodesk-forge - 对象在桶中消失,(Autodesk forge)
- php - 在 codeigniter 中使用 socket.io
- mysql - MySQL 查询中的“ON DUPLICATE KEY UPDATE column_name = VALUES(column_name)”是什么?
- python-2.7 - 如何仅使用 sqlalchemy 核心为表的 2 个布尔列定义检查约束
- python - 使用从现有 DataFrame 获得的列表的输出创建新的 DataFrame
- teamcity - 仅当用户是 Github 组织的成员时才触发 Teamcity 构建
- node.js - 我只获得一次所有数据
- python - 按钮、树形视图的自定义样式