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

编译Android Studio 2024.2.1源码失败:缺失指定插件模块

编译Android Studio 2024.2.1源码时缺失C系插件模块的解决办法

在Pop!_OS 22.04 LTS x86_64环境下,编译Android Studio 2024.2.1源码执行tools/idea/build_studio.sh时,触发以下错误:

java.lang.IllegalStateException: The following modules from productProperties.productLayout.bundledPluginModules aren't found in the project: [intellij.c.clangd.plugin, intellij.c.clangdBridge.plugin, intellij.c.plugin, intellij.cidr.debugger.plugin, intellij.cidr.base.plugin, intellij.cidr.clangConfig.plugin, intellij.cidr.clangFormat.plugin, intellij.rml.dfa.plugin]

官方文档未提及这些插件的安装步骤,且IntelliJ IDEA编译说明已过时,未覆盖该依赖问题。以下是可行的解决步骤:


1. 同步对应版本的IntelliJ插件源码

Android Studio依赖JetBrains IntelliJ的C/C++相关插件模块,需拉取匹配版本的源码:

  • 进入源码根目录下的tools/idea文件夹
  • 执行命令添加仓库并同步对应分支(替换242.xxxx为Android Studio 2024.2.1基础IntelliJ版本号,可在Studio的「关于」页面查看):
git remote add intellij https://github.com/JetBrains/intellij-community.git
git fetch intellij refs/heads/242.xxxx:refs/remotes/intellij/242.xxxx
git merge intellij/242.xxxx --no-commit --no-ff

2. 临时排除未找到的模块(无需C/C++功能时用)

如果不需要Android Studio的C/C++开发支持,可修改编译配置跳过这些模块:

  • 打开tools/idea/build/android_studio_build_target.kt文件
  • 找到productProperties.productLayout.bundledPluginModules配置项,移除报错列表中的所有模块
  • 保存后重新执行tools/idea/build_studio.sh

3. 安装系统编译依赖

确保系统已安装C系插件编译所需的基础依赖:

sudo apt update && sudo apt install -y clang llvm libclang-dev build-essential

4. 重置构建环境

清理缓存并重新初始化构建环境:

./gradlew clean
./gradlew :studio:prepare

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 06:23:16