You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 18:22:53