aosp11/12/13 framework源码开发IDE工具之idegen/aidegen/AIDEGen详细使用

news2024/10/2 14:33:26

hi,粉丝朋友:

近期又粉丝朋友聊到了如果做aosp系统应用开发,有什么工具或者方式来导入代码可以正常跳转和代码提示等?
更多内容: https://blog.csdn.net/learnframework/article/details/130016893

Android Studio导入系统源码

针对这个问题其实我课程里面的[入门课就有有讲解android studio导入整套系统源码]的详细说明,这里就再次补充一下android studio导入android系统源码
1、生成对应的android.ipr和android.iml文件

 make idegen -j4
 “development/tools/idegen/idegen.sh” (报错find: ‘out/target/product/generic_x86_64/root/d’: Permission denied没有关系不影响ipr和iml文件生成)
 sudo chmod 777 android.iml android.ipr
 2、有了ipr和iml,删减一部分android.iml的内容,主要原因源码太多,要排除部分没用项目,还有就是依赖部分只留下自己moudle就可以
 把android.iml中的excludeFolder标签都删除用以下标签
<excludeFolder url="file://$MODULE_DIR$/art" />
      <excludeFolder url="file://$MODULE_DIR$/bionic" />
      <excludeFolder url="file://$MODULE_DIR$/bootable" />
      <excludeFolder url="file://$MODULE_DIR$/build" />
      <excludeFolder url="file://$MODULE_DIR$/compatibility" />
      <excludeFolder url="file://$MODULE_DIR$/cts" />
      <excludeFolder url="file://$MODULE_DIR$/dalvik" />
      <excludeFolder url="file://$MODULE_DIR$/developers" />
      <excludeFolder url="file://$MODULE_DIR$/developers/samples" />
      <excludeFolder url="file://$MODULE_DIR$/development" />
      <excludeFolder url="file://$MODULE_DIR$/device" />
      <excludeFolder url="file://$MODULE_DIR$/device/google" />
      <excludeFolder url="file://$MODULE_DIR$/device/sample" />
      <excludeFolder url="file://$MODULE_DIR$/docs" />
      <excludeFolder url="file://$MODULE_DIR$/external" />
      <excludeFolder url="file://$MODULE_DIR$/flashing-files" />
      <excludeFolder url="file://$MODULE_DIR$/frameworks/base/docs" />
      <excludeFolder url="file://$MODULE_DIR$/hardware" />
      <excludeFolder url="file://$MODULE_DIR$/kernel" />
      <excludeFolder url="file://$MODULE_DIR$/libcore" />
      <excludeFolder url="file://$MODULE_DIR$/libnativehelper" />
      <excludeFolder url="file://$MODULE_DIR$/out" />
      <excludeFolder url="file://$MODULE_DIR$/out/soong/.intermediates" />
      <excludeFolder url="file://$MODULE_DIR$/pdk" />
      <excludeFolder url="file://$MODULE_DIR$/platform_testing" />
      <excludeFolder url="file://$MODULE_DIR$/prebuilt" />
      <excludeFolder url="file://$MODULE_DIR$/prebuilts" />
      <excludeFolder url="file://$MODULE_DIR$/sdk" />
      <excludeFolder url="file://$MODULE_DIR$/shortcut-fe" />
      <excludeFolder url="file://$MODULE_DIR$/system" />
      <excludeFolder url="file://$MODULE_DIR$/test" />
      <excludeFolder url="file://$MODULE_DIR$/toolchain" />
      <excludeFolder url="file://$MODULE_DIR$/tools" />

把orderEntry标签都删除,只剩下如下两个即可以,这样跳转时候就不会跳其他jar

 <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="jdk" jdkName="Android API 33 Platform" jdkType="Android SDK" />

这样android studio就完全可以进行相关的跳转了,同时各个app其实也可以进行跳转,如下图的Settings:

在这里插入图片描述

这种其实也有一些androidx库依赖标红啥的,这个相对比较少影响不是太大,不过这个也可能是很多同学不喜欢的点,那么有啥更好办法解决么?当然有,那就是今天主题AIDEGen

AIDEGen导入各个模块代码

AIDEGen相关文档:
tools/asuite/aidegen/README.md

首先看它的相关官方readme,英文的,其实也比较好懂,这里就不做翻译了,我相信也完全可以看懂

AIDEGen

AIDEGen aims to automate the project setup process for developers to work on
Java or C/C++project in popular IDE environment. Developers no longer need to manually
configure an IntelliJ project, such as all the project dependencies. It’s a
command line tool that offers the following features:

  • Configure Android Studio or IntelliJ project files with the relevant module
    dependencies resolved.

  • Launch IDE for a specified sub-project or build target, i.e. frameworks/base
    or Settings.

  • Launch IDE for specified folder(s) which contains build targets, i.e. cts.

  • Auto configure JDK and Android coding style for IntelliJ.

(上面其实就是说明了一下AIDEGen是干啥的,大概意思就是它是一个自动生成项目配置文件,针对不同的主流ide都是可以的,比如 Android Studio or IntelliJ project等,就不需要我们自己针对不同ide来搞对应项目)

1. Prerequisites:

  • IDE installation, choose one of prefer IDE, including Android Studio,
    IntelliJ IDEA, Eclipse, CLion and VS Code.

  • Setup Android development environment.

$ source build/envsetup.sh && lunch <TARGET>

(以上是预备条件,配置好aosp的env和lunch,而且要本身系统安装好了的对应的ide,比如Android Studio,IntelliJ IDEA, Eclipse, CLion and VS Code)

2. Basic Usage:

Example 1: Launch IDE with module name

Example to generate and launch IntelliJ project for framework and Settings:
可以直接使用module name来进行对应的启动

$ aidegen Settings framework

Example 2: Launch IDE with module path

Example to generate and launch IntelliJ project for framework and Settings:
可以直接使用module path来进行对应的启动

$ aidegen packages/apps/Settings frameworks/base

Example 3: Launch IDE with build skipped

Example to generate and launch IntelliJ project for framework and Settings and
skip build time:
这里可以用-s来跳过编译,一般使用这种如果已经编译了的话

$ aidegen Settings framework -s

Example 4: Launch IDE with native module

Example to generate and launch CLion project:

$ aidegen <module> -i c

The native projects will be launched in CLion and you have to select,
Tools > CMake > Change Project Root
Change project root to the source directory: the relative path which is the directory shown in CLion’s project view. For example, if frameworks/base/media is your project, please change project root directly to frameworks/base/media.

3. Optional arguments:

Developers can also use the following optional arguments with AIDEGen commands.

OptionLong optionDescription
-d--depthThe depth of module referenced by source.
-i--ideLaunch IDE type, j=IntelliJ s=Android Studio e=Eclipse c=CLion v=VS Code
-p--ide-pathSpecify user’s IDE installed path.
-n--no_launchDo not launch IDE.
-r--config-resetReset all AIDEGen’s saved configurations.
-s--skip-buildSkip building jars or modules.
-v--verboseDisplays DEBUG level logging.
-a--android-treeGenerate whole Android source tree project file for IDE.
-e--exclude-pathsExclude the directories in IDE.
-l--languageLaunch IDE with a specific language,j=java c=C/C++ r=Rust
-h--helpShows help message and exits.

4. Troubleshooting tips:

If you get an error like: “Dependent modules dictionary is empty.” or other errors, try a make
clean.

5. FAQ:

Q1. If I already have an IDE project file, and I run command AIDEGen to generate
the same project file again, what’ll happen?

A1: The former IDEA project file will be overwritten by the newly generated one
from the aidegen command.

Q2: When do I need to re-run AIDEGen?

A2: Re-run AIDEGen after repo sync.

6. Hint:

  1. In IntelliJ, uses [File] > [Invalidate Caches / Restart…] to force
    project panel updated when your IDE didn’t sync.

  2. If you run aidegen on a remote desktop, make sure there is no IntelliJ
    running in a different desktop session.

6. Feedback:

If you have any questions or feedback, contact aidegen_tnn@google.com.

If you have any bugs or feature requests email them to buganizer-system+429701@google.com.

实战体验Settings

命令:

aidegen packages/apps/Settings -i s -s

在这里插入图片描述

针对androidx等也不会报错
在这里插入图片描述

相对系统app来说确实体验还是很不错,比源码整体导入那种相对更好一些,也非常简单,不需要为了Setting导入整套代码,跳转framework部分的代码也是正常的:
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/428503.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【pycharm】往svn仓库commit过滤文件

目录 一、配置好SVN仓库 二、新建一个changelist 1、找到下方版本控制 2、右击 3、新增一个不提交的changelist&#xff08;这里其实就是忽略的列表&#xff09;将不提交的都放这里 三、将忽略的文件加入不提交的changelist 1、修改一个版本控制文件和新增一个不提交文件…

5G入海, 智慧海洋从此“联通”!

湛江&#xff0c;位于中国大陆的最南端&#xff0c;是一座向海而生的城市。近年来&#xff0c;中国联通在湛江打造智慧渔船管理平台&#xff0c;通过专用系统监控平台、岸基子系统、船载子系统三大平台实现九大核心功能&#xff0c;守卫1200多公里的大陆海岸线&#xff0c;赋能…

SpringMVC 请求与响应

一、请求映射路径 1.1、环境准备 创建一个Web的Maven项目并在pom文件中添加依赖 <?xml version"1.0" encoding"UTF-8"?><project xmlns"http://maven.apache.org/POM/4.0.0" xmlns:xsi"http://www.w3.org/2001/XMLSchema-ins…

pwnable_orw-seccomp沙箱

1&#xff0c;三连 2&#xff0c;IDA静态分析 知识点引入&#xff1a; seccomp 是 secure computing 的缩写&#xff0c;其是 Linux kernel 从2.6.23版本引入的一种简洁的 sandboxing 机制。在 Linux 系统里&#xff0c;大量的系统调用&#xff08;system call&#xff09;直…

基于springboot+mybatis的图书购物网站

目录一. &#x1f981; 前言1.1 研究目的和意义1.2 所做的主要工作二. &#x1f981; 技术介绍2.1 B/S结构2.2 MySQL 介绍2.3 Java介绍2.4 Spring boot 框架及特点2.5 Mybatis框架特点三. &#x1f981; 系统功能结构1.1 用户管理功能1.2 管理员管理功能四. &#x1f981; 系统…

ppt文件太大怎么压缩变小,4个方法快速学

ppt文件太大怎么压缩变小&#xff1f;现在都流行线上教学&#xff0c;很多教学的课件都是使用PPT 进行的。但是这些PPT体积往往都非常的大&#xff0c;如果是那种使用时间较长的电脑光是打开这类PPT就非常卡顿了。有的甚至就无法打开这些PPT&#xff0c;或者说打开这些ppt文件但…

智慧工地火焰烟火识别检测系统 opencv

智慧工地火焰烟火识别检测系统通过pythonopencv网络模型算法分析技术&#xff0c;智慧工地火焰烟火识别检测算法模型实现对现场画面中火焰烟雾进行7*24小时不间断识别&#xff0c;实时分析自动报警Python是一种由Guido van Rossum开发的通用编程语言&#xff0c;它很快就变得非…

【ChatGPT】中国支付清算协会倡议支付行业从业人员谨慎使用ChatGPT

ChatGPT1. 近期热议2. ChatGPT是什么3. ChatGPT要谨慎使用4. 如何规范使用1. 近期热议 近期&#xff0c;ChatGPT等工具引起各方广泛关注&#xff0c;已有部分企业员工使用ChatGPT等工具开展工作。但是&#xff0c;此类智能化工具已暴露出跨境数据泄露等风险。为有效应对风险、…

物业企业如何加快向现代服务业转型

近年来&#xff0c;随着人民生活水平的提高&#xff0c;人们对住宅质量提出更高的要求&#xff0c;在此前提下&#xff0c;全国各地涌现出了一些运用现代的计算机、控制与通信技术建设的智能化住宅小区。但是许多智能化住宅小区都存在建好了智能硬件环境却没有智能化的软件在上…

基于html+css的图片展示14

准备项目 项目开发工具 Visual Studio Code 1.44.2 版本: 1.44.2 提交: ff915844119ce9485abfe8aa9076ec76b5300ddd 日期: 2020-04-16T16:36:23.138Z Electron: 7.1.11 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Windows_NT x64 10.0.19044 项目…

在现代信号处理中,多种时频分析方法可以进行融合吗?

当然可以&#xff0c;以短时傅里叶变换STFT和WVD分析为例进行说明。 STFT得到的时频矩阵没有交叉项的干扰&#xff0c;但时频聚集性无法兼得&#xff1b;而WVD恰恰相反&#xff0c;其时频矩阵 能兼顾时频聚集性&#xff0c;但对多分量信号进行处理会产生交叉项。 为获得时频聚…

axial attention 轴向注意力

Medical Transformer: Gated Axial-Attention for Medical Image Segmentation 论文解读&#xff1a; https://zhuanlan.zhihu.com/p/408662947 实验结果: 0 前言 0.1 原始的注意力机制 0.2 轴向注意力机制 相对位置编码 0.3 在轴向注意力机制基础上 gated 门控单元 门控轴…

pytest测试报告Allure - 动态生成标题生成功能、添加用例失败截图

一、动态生成标题 默认 allure 报告上的测试用例标题不设置就是用例名称&#xff0c;其可读性不高&#xff1b;当结合 pytest.mark.parametrize 参数化完成数据驱动时&#xff0c;如标题写死&#xff0c;其可读性也不高。 那如果希望标题可以动态的生成&#xff0c;采取的方案…

(附3D大屏模板)详解FineVis如何打造智慧医院BIM方案!

近日&#xff0c;又一所三甲医院搭建起了智慧医院&#xff0c;它是深圳大鹏新区人民医院&#xff0c;采用IBM技术&#xff0c;是一家集医疗、科研、预防保健和康复疗养功能的综合体。 这栋建筑包含床位数2000个&#xff0c;总建筑面积417444平方米&#xff0c;建筑高度79.75米…

第四章 法的效力

目录 第一节 法的效力概述 一、法的效力的意义二、法的效力的概念三、法的效力范围 第二节法的时间效力 一、法的生效时间二、法的失效时间三、法律溯及力 第三节法的空间效力 一、法的域内效力二、法的域外效力 第四节 法的对人效力 一、对人效力的原则二、我国法律的对人效力…

epoll 反应堆模型(Libevent库核心思想)

epoll 反应堆模型总述 epoll 反应堆模型是从 libevent 库里面抽取的核心代码。 epoll ET模式 非阻塞、轮询 void *ptr 反应堆的理解&#xff1a;参考理解 加入IO转接之后&#xff0c;有了事件&#xff0c;server才去处理&#xff0c;这里反应堆也是这样&#xff0c;由于网络…

ssm框架之SpringMVC:浅聊获得参数以及获得请求头参数

前面聊过了SpringMVC&#xff0c;以及通过实例演示了SpringMVC如何搭建&#xff0c;如果对环境搭建不太了解的话&#xff0c;可以看一下前面的文章&#xff08;下面演示的例子&#xff0c;环境都是通过上面的例子进行演示的&#xff09;&#xff1a;传送阵 在使用javaweb项目原…

30天学会《Streamlit》(2)

30学会《Streamlit》是一项编码挑战&#xff0c;旨在帮助您开始构建Streamlit应用程序。特别是&#xff0c;您将能够&#xff1a; 为构建Streamlit应用程序设置编码环境 构建您的第一个Streamlit应用程序 了解用于Streamlit应用程序的所有很棒的输入/输出小部件 第2天 - 构建…

Kubernetes部署Nacos集群

一、k8s架构 master: 11.0.1.3 node: 11.0.1.4,11.0.1.5(nfs) nfs: 11.0.1.5 二、安装nfs 安装nfs-utils和rpcbind nfs客户端和服务端都安装nfs-utils包 yum install nfs-utils rpcbind -y创建共享目录 mkdir -p /nfsdata chmod 777 /nfsdata编辑/etc/exports文件添加如下…

【部署项目】记录一些踩到的坑

这里写自定义目录标题记录一些踩到的坑设置二级域名注意事项文件访问权限记录一些踩到的坑 这个帖子是用来记录自己在windows和linux下进行部署项目时遇到的坑,以及对应的解决办法 设置二级域名 当你只有一个域名又不想买新的域名的时候(域名其实很便宜,贵在租服务器上),二级…