Android --- AOSP源码导入Android Studio

AOSP代码量庞大,为了开发的方便,我们需要导入到android studio中,其中关键的一 项就是配置跳转。尤其是对于Framework开发来说

生成 ipr,iml 工程文件

复制代码
make idegen
./development/tools/idegen/idegen.sh

会生成如下文件

首先需要修改ipr和iml文件的权限,防止无法保存导致每次重新配置

复制代码
sudo chmod 777 android.iml
sudo chmod 777 android.ipr

接下来需要对android.iml文件进行配置

① orderEntry标签仅保留sourceFolder,这能防止源码跳转到各种jar包中

复制代码
......
 </content>
 <orderEntry type="sourceFolder" forTests="false" />
 <orderEntry type="inheritedJdk" />
 <orderEntryProperties />
 </component>
 </module>

② 增加excludeFolder标签,将不需要的路径exclude掉,例如:

复制代码
<excludeFolder url="file://$MODULE_DIR$/.repo" />
 <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$/cts" />
 <excludeFolder url="file://$MODULE_DIR$/dalvik" />
 <excludeFolder url="file://$MODULE_DIR$/developers" />
根据自己需要进行exclude,这里省略
......

然后使用Android Studio选择android.ipr文件打开整个AOSP即可~

相关推荐
apihz19 小时前
全球IP归属地查询免费API详细指南
android·服务器·网络·网络协议·tcp/ip
hgz071020 小时前
Linux环境下MySQL 5.7安装与配置完全指南
android·adb
Just_Paranoid20 小时前
【Android UI】Android 添加圆角背景和点击效果
android·ui·shape·button·textview·ripple
梁同学与Android20 小时前
Android ---【经验篇】阿里云 CentOS 服务器环境搭建 + SpringBoot项目部署(二)
android·spring boot·后端
风往哪边走20 小时前
自定义简易日历
android
xuyin120420 小时前
android 如何提高message的优先级
android
PyAIGCMaster20 小时前
安卓原生开发工具,一性性成生所有类型图标。
android
_李小白20 小时前
【Android FrameWork】延伸阅读:StorageStatsService 与应用目录管理
android
Just_Paranoid21 小时前
【SystemUI】基于 Android R 实现下拉状态栏毛玻璃背景
android·canvas·systemui·renderscript