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

Android Studio Electric Eel更新后Jetpack Compose预览失效求助

Android Studio Electric Eel版本Jetpack Compose预览Missing classes错误解决方法

输入图片描述

更新Android Studio到Electric Eel版本后,Jetpack Compose预览功能出现Missing classes错误,可尝试以下方案解决:

  • 清理并重建项目:点击顶部菜单栏Build -> Clean Project,完成后执行Rebuild Project,清除编译缓存。
  • 同步Gradle依赖:点击右上角的Sync Project with Gradle Files按钮,确保所有依赖同步完成,尤其是Compose相关依赖版本与IDE兼容。
  • 统一Compose依赖版本:使用Compose BOM来管理依赖,避免版本不匹配问题,示例配置:
    dependencies {
        implementation platform('androidx.compose:compose-bom:2023.01.00')
        implementation 'androidx.compose.ui:ui'
        implementation 'androidx.compose.ui:ui-tooling-preview'
        debugImplementation 'androidx.compose.ui:ui-tooling'
    }
    
  • 检查模块Compose配置:确认模块的build.gradle中正确启用Compose,且Kotlin编译器扩展版本与依赖适配:
    android {
        buildFeatures {
            compose true
        }
        composeOptions {
            kotlinCompilerExtensionVersion '1.4.3' // 需与Compose依赖版本对应
        }
    }
    
  • 禁用Instant Run:打开File -> Settings -> Build, Execution, Deployment -> Instant Run,取消勾选Enable Instant Run后重启IDE。
  • 清除IDE缓存:点击File -> Invalidate Caches...,选择Invalidate and Restart,彻底清除缓存后重启Android Studio。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.01 11:55:26