Android Studio 导入源码

22 篇文章 7 订阅
13 篇文章 0 订阅

目前做framework开发,仅仅导入framework源码进行查看,发现很多跳转并不能跳转,

得益于公司配备的电脑性能超好,查看的时候导入源码进行查看比较方便。

1.拷贝android.iml 和 android.ipr 放到源码根目下面

如下路径

development/tools/idegen/templates/android.iml
development/tools/idegen/templates/android.ipr

2.打开 根目录下拷贝的android.iml 文件 用如下代码替换掉  SOURCE_FOLDERS

    <content url="file://$MODULE_DIR$">
     //替换掉 
      SOURCE_FOLDERS
    </content>

替换之后 

    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/external" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/miui" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/vendor" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/frameworks" isTestSource="false" />
      <excludeFolder url="file://$MODULE_DIR$/.repo" />
      <excludeFolder url="file://$MODULE_DIR$/abi" />
      <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" />
      <excludeFolder url="file://$MODULE_DIR$/development" />
      <excludeFolder url="file://$MODULE_DIR$/device" />
      <excludeFolder url="file://$MODULE_DIR$/docs" />
      <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$/ndk" />
      <excludeFolder url="file://$MODULE_DIR$/out" />
      <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$/rc_projects" />
      <excludeFolder url="file://$MODULE_DIR$/sdk" />
      <excludeFolder url="file://$MODULE_DIR$/system" />
      <excludeFolder url="file://$MODULE_DIR$/tools" />
      <excludeFolder url="file://$MODULE_DIR$/trusty" />
    </content>

3.AndroidStudio 打开根目录 android.ipr 过程比较慢,耐心等待

4.导入完成之后点击 Progect Structure-->点击Modules 再点击 Dependencies

5.点击 + 号 选择 JARS OR Directories 将frameworks 和external 分别 导入项目 --> Apply

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值