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

Android Studio Giraffe创建Wear OS项目仅显示Compose选项求助

解决Android Studio Giraffe创建项目仅显示Compose for Wear OS的问题
  • 检查组件安装完整性
    打开Android Studio的Settings(Windows/Linux)或Preferences(Mac),进入Appearance & Behavior > System Settings > Android SDK,切换到SDK Tools标签,确保勾选Android SDK Build-Tools、Android SDK Platform-Tools,以及对应Android版本的SDK Platform。同时确认Giraffe版本所需的Android Gradle Plugin和Gradle已正确安装。

  • 重置Android Studio缓存
    关闭Android Studio,删除对应缓存目录:

    • Windows:C:\Users\<你的用户名>\.AndroidStudioGiraffe\system\caches
    • Mac:~/Library/Caches/Google/AndroidStudioGiraffe
    • Linux:~/.AndroidStudioGiraffe/system/caches
      重启Android Studio后再尝试创建项目。
  • 确认设备筛选选项
    在新项目创建界面,检查左上角的下拉筛选菜单,确保选中了Phone and Tablet,而非仅勾选Wear OS。如果筛选条件限定为Wear OS,自然只会显示对应的Compose项目选项。

  • 手动转换项目类型(替代方案)
    若上述方法无效,可先创建空Compose项目,再手动修改配置转为View项目:

    1. 删除app/src/main/java下的Compose相关代码文件
    2. 修改app/build.gradle.kts(或.gradle):
      • 将buildFeatures { compose = true }替换为buildFeatures { viewBinding = true }(按需开启)
      • 删除composeOptions配置块
      • 移除Compose依赖,添加View项目所需依赖(如implementation 'androidx.appcompat:appcompat:1.6.1')
    3. 修改AndroidManifest.xml,将启动Activity的布局指向新建的XML布局文件
    4. 创建对应的XML布局和Activity类

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 07:22:09