赞
踩
进入项目根目录,执行
source build/envsetup.sh
lunch 项目版本号
make idegen -j16
编译完成后有idegen.jar生成
执行
development/tools/idegen/idegen.sh
会生成
android.ipr 和android.iml文件
若出现Couldn’t find idegen.jar. Please run make first.则需要执行
source build/envsetup.sh
mmm development/tools/idegen/
然后再执行
development/tools/idegen/idegen.sh
导入整个源码不仅浪费资源而且也会比较耗时,这时候需要给需要的目录导入到工程,打开android.iml文件,给不需要导入工程的目录添加进去(这个根据自己的需要),将以下内容复制到标签内
<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$/docs" /> <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$/prebuilt" /> <excludeFolder url="file://$MODULE_DIR$/prebuilts" /> <excludeFolder url="file://$MODULE_DIR$/sdk" /> <excludeFolder url="file://$MODULE_DIR$/tools" />
打开Android Studio,File->open,选择需要导入工程根目录下的android.ipr文件
因为AS默认会关联SDK里面的源码,为方便查看项目的源码,需要把SDK源码关联解除,这样我们点击查看某个class时就会打开项目源码的java文件,而不是SDK的class文件
File->Projects Structure->SDKs,新建一个取名JasonJDK,清空Classpath、Sourcepath、Annotations、Documentation Paths,也就是说新建一个空的JDK路径
选择Android API 32 Platform,如果没有的话去Android SDK里面随便下载一个版本即可,然后在Java SDK栏选择干刚刚新建的JasonJDK,清空Classpath,Sourcepath,Annotations,Documentation Paths
点击Project,SDK栏选择Android API 32 Platform
点击Modules,点击android,在Dependencies栏删除除和Android API 32 Platform以外的所有jar
最后点击Apply->OK即可
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。