Release模式下Flow emit崩溃问题排查求助
问题排查:Release模式下应用持续崩溃
问题触发条件
- 仅在Release模式且
debuggable=false时,应用会持续崩溃 - 对应Gradle配置:
release { minifyEnabled true shrinkResources true debuggable false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.debug }
崩溃代码定位
通过逐行注释排查,确定崩溃触发于以下代码行:
emit(Resource.Success(listOf( dayMarketChartResponse.body()!!.toMarketChartEntityList(), threeMonthMarketChartResponse.body()!!.toMarketChartEntityList(), yearMarketChartResponse.body()!!.toMarketChartEntityList(), )))
特殊现象
若使用假数据替换上述三个子列表中的任意一个,应用便不会崩溃。
补充说明(2023年6月13日)
已为数据类添加SerializedName注解以避免混淆,相关代码如下:
data class MarketChartDto( @SerializedName("market_caps") val marketCaps: List<List<Double>>, @SerializedName("prices") val prices: List<List<Double>>, @SerializedName("total_volumes") val totalVolumes: List<List<Double>> ) fun MarketChartDto.toMarketChartEntityList() : List<MarketChartEntity> { return this.prices.map { MarketChartEntity( price = it[1] ) } }
目前排查过程中可能遗漏了某些关键点,可补充更多上下文信息,请求协助定位问题。
内容的提问来源于stack exchange,提问作者Kochez
相关产品推荐
相关产品推荐

