google 原文,https://source.android.google.cn/docs/setup/download?hl=zh-cn
详细参考需翻墙:https://android.googlesource.com/platform/tools/asuite/+/refs/heads/master/aidegen/README.md
1.设置编译环境
$ source build/envsetup.sh && lunch <TARGET>
2.启动Python脚本生成as工具需要的结构
-d |
--depth |
The depth of module referenced by source. |
-i |
--ide |
Launch IDE type, j=IntelliJ s=Android Studio e=Eclipse c=CLion v=VS Code |
-p |
--ide-path |
Specify user's IDE installed path. |
-n |
--no_launch |
Do not launch IDE. |
-r |
--config-reset |
Reset all AIDEGen's saved configurations. |
-s |
--skip-build |
Skip building jars or modules. |
-v |
--verbose |
Displays DEBUG level logging. |
-a |
--android-tree |
Generate whole Android source tree project file for IDE. |
-e |
--exclude-paths |
Exclude the directories in IDE. |
-l |
--language |
Launch IDE with a specific language,j=java c=C/C++ r=Rust |
-h |
--help |
Shows help message and exits. |
$ aidegen Settings -i s
备注:我这边报错:ModuleNotFoundError: No module named ‘distutils.util 的解决方法
先使用python 下载 这个库,安装成功后在执行 步骤2.等。
$ sudo apt-get install python3-distutils
执行完第二步以后会自动打开Android studio 。请提前将as的bin目录加到path里面去