iml文件是所有IntelliJ IDEA都会自动生成的一个文件,(Android Studio是基于IntelliJ IDEA开发的),iml是 intellij idea的工程配置文件,里面是当前projec的一些配置信息
原文地址:http://blog.youkuaiyun.com/zhangbuzhangbu/article/details/52237286
最早使用Android Studio的时候,对这两个文件的使用并不熟悉,因为Studio会帮你管理一切。但对于Intellij Idea来说,一切变得不同,很多对项目的管理都回到了基本层级。下面介绍一下iml文件、modules.xml文件
我们在Intellij Idea中打开modules文件,是这样的
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<!--module指定需要编译lib或者主程序绝对路径、相对路径-->
<module fileurl="file://$PROJECT_DIR$/ExportJar.iml" filepath="$PROJECT_DIR$/ExportJar.iml" />
<module fileurl="file://$PROJECT_DIR$/child/child.iml" filepath="$PROJECT_DIR$/child/child.iml" />
</modules>
</component>
</project>
这个文件告诉编译器你要有哪几个子项目,不分主次
而iml文件是这样的
<?xml version="1.0" encoding="UTF-8"?>
<module type="PLUGIN_MODULE" version="4">
<!--intellij插件配置文件-->
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
<!--使用默认编译输出目录,编译器会将编译的class文件放到此目录中-->
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$"><!--指定项目根目录-->
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /><!--指定Source源码目录-->
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" /><!--指定资源文件目录-->
</content>
<orderEntry type="inheritedJdk" /><!---->
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="child" /><!--指定lib模块-->
</component>
</module>
一般来说,这两个文件都比较重要,每当项目无法正确加载时,可能就是这两个配置文件出了问题