1、通过修改文件android.iml师不需要加载的源码exclude,如下所示:
<sourceFolder url="file://$MODULE_DIR$/sdk/testapps/testProjectTest/testlib/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/sdk/testapps/testSensors/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/sdk/testapps/userLibTest/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tools/external/fat32lib/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.repo" />
<excludeFolder url="file://$MODULE_DIR$/external/bluetooth" />
<excludeFolder url="file://$MODULE_DIR$/external/chromium" />
<excludeFolder url="file://$MODULE_DIR$/external/emma" />
<excludeFolder url="file://$MODULE_DIR$/external/icu4c" />
<excludeFolder url="file://$MODULE_DIR$/external/jdiff" />
<excludeFolder url="file://$MODULE_DIR$/external/webkit" />
<excludeFolder url="file://$MODULE_DIR$/frameworks/base/docs" />
<excludeFolder url="file://$MODULE_DIR$/out" />
<excludeFolder url="file://$MODULE_DIR$/out/eclipse" />
<excludeFolder url="file://$MODULE_DIR$/out/host" />
<excludeFolder url="file://$MODULE_DIR$/out/target/common/docs" />
<excludeFolder url="file://$MODULE_DIR$/out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates" />
<excludeFolder url="file://$MODULE_DIR$/out/target/product" />
<excludeFolder url="file://$MODULE_DIR$/prebuilt" />
2、打开android studio之后,通过Project Structure打开Module Setting,选择要排除的源码,右键选择Excluded即可将源码免去扫描