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

问询:Jetpack Profileinstaller被打包进Release APK及Compose依赖原因

关于androidx.profileinstaller在Compose UI Release构建中存在的原因及崩溃处理

为什么Release构建中会包含profileinstaller?

  • androidx.profileinstaller:profileinstaller 是Compose UI 1.3.0默认集成的依赖,核心作用是在应用首次启动时自动安装Baseline Profile(基线配置文件)。这个配置文件能让ART虚拟机提前编译应用的关键代码路径,减少运行时JIT编译的开销,从而提升应用启动速度和整体运行性能。
  • 它并非Debug环境专属,Compose团队默认在Release构建中保留该依赖,是为了让所有用户都能享受到Baseline Profile带来的性能优化。

针对ProfileInstallReceiver崩溃的处理建议

  • 如果崩溃确实由该Receiver引发,可通过以下两种方式处理:
    1. 排除依赖:在模块的build.gradle或build.gradle.kts中,给Compose UI依赖添加排除规则:
      implementation("androidx.compose.ui:ui:1.3.0") {
          exclude group: "androidx.profileinstaller", module: "profileinstaller"
      }
      
    2. 禁用Profile安装功能:在gradle.properties中添加配置项:
      android.baselineProfile.disable=true
      
  • 注意:移除或禁用该依赖后,会失去Baseline Profile带来的性能优化,建议先确认崩溃是否为该组件的普遍问题,再做权衡取舍。

内容的提问来源于stack exchange,提问作者mtotschnig

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.14 14:15:41