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

Android Studio构建失败:com.google.android.material依赖API版本问题求助

解决com.google.android.material:material:1.10.0-alpha01依赖与compileSdk版本不兼容问题

方案1:降级Material依赖到稳定版

com.google.android.material:material:1.10.0-alpha01是预览版本,仅适配Android UpsideDownCake(API 34预览版),如果你的项目不需要预览特性,直接换成兼容API 33的稳定版本即可:

  • 打开模块级build.gradle(或build.gradle.kts)文件
  • 找到Material依赖行,将版本改为1.9.0(当前兼容API33的最新稳定版)
    // 修改前
    implementation 'com.google.android.material:material:1.10.0-alpha01'
    // 修改后
    implementation 'com.google.android.material:material:1.9.0'
    
  • 点击Sync Now同步项目即可解决报错

方案2:升级compileSdk到UpsideDownCake预览版

如果想体验Material组件的预览新特性,按以下步骤操作:

  1. 打开Android Studio的SDK Manager(路径:Tools > SDK Manager)
  2. 在SDK Platforms标签页,勾选Android UpsideDownCake Preview并完成下载
  3. 打开模块级build.gradle(或build.gradle.kts)文件,修改编译配置:
    // 修改前
    compileSdk 33
    // 修改后
    compileSdkPreview "UpsideDownCake"
    
  4. 同步项目完成配置更新

注意:预览SDK存在不确定性,不建议在正式生产项目中使用。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 22:22:42