Android Studio import and associate framework source code

Execute the command compile in the source code directory

. build/envsetup.sh  

mmm development/tools/idegen/

.  development/tools/idegen/idegen.sh

After completing the above, you will find that two new files appear in the root directory of the source code

1. android.iml (records the modules, dependencies, SDK versions, etc. included in the project, similar to an XML file)

2. android.ipr (the specific configuration of the project, the code and the dependent lib and other information, similar to the sln file of Visual Studio)

修改文件权限
sudo chmod 777 android.iml
sudo chmod 777 android.ipr

Modify the android.iml file to exclude the directories that do not need to be imported, and the first import is faster

    <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$/compatibility" />
    <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/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$/kernel" />
    <excludeFolder url="file://$MODULE_DIR$/libcore" />
    <excludeFolder url="file://$MODULE_DIR$/libnativehelper" />
    <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$/shortcut-fe" />
    <excludeFolder url="file://$MODULE_DIR$/test" />
    <excludeFolder url="file://$MODULE_DIR$/toolchain" />
    <excludeFolder url="file://$MODULE_DIR$/tools" />

Open android.ipr with Android studio to open the source code project

Configure the sdk version, my source code is 7.1.1

 Select the android25 just configured and apply it.

 In this way, when you click on AMS, you will jump directly to the AMS source code instead of the class in the jar

 

Guess you like

Origin blog.csdn.net/gxhea/article/details/126866027