什么是Android Studio中的.iml文件? [英] What are .iml files in Android Studio?

查看:215
本文介绍了什么是Android Studio中的.iml文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android Studio项目中的 .iml 文件是什么?我读到它是模块的配置文件.我不了解它是如何工作的,我不能仅仅使用gradle脚本与您添加到项目中的外部模块进行集成.

What are .iml files in Android Studio project? I read that it is configuration file for modules. I do not understand how it works, and can't I just use gradle scripts to integrate with external modules that you add to your project.

而且,大多数时候AS都会生成它们,所以我无法控制项目行为.如果我有一个在不同的IDE(例如Eclipse和AS)中工作的团队,是否可以设置我的项目,使其与IDE无关?

Also, most of the time AS generates them, so I cannot control project behaviour. If I have a team that works in different IDEs like Eclipse and AS, is it possible to setup my project so it's IDE agnostic?

我不完全了解该系统的工作原理.

I don't fully understand how this system works.

推荐答案

Android Studio项目中的iml文件是什么?

What are iml files in Android Studio project?

iml文件上进行Google搜索:

A Google search on iml file turns up:

IML是由IntelliJ IDEA(一种用于开发Java应用程序的IDE)创建的模块文件.它存储有关开发模块的信息,该模块可以是Java,Plugin,Android或Maven组件.保存模块路径,依赖项和其他设置.

IML is a module file created by IntelliJ IDEA, an IDE used to develop Java applications. It stores information about a development module, which may be a Java, Plugin, Android, or Maven component; saves the module paths, dependencies, and other settings.

(来自此页面)

为什么不使用gradle脚本与添加到项目中的外部模块进行集成.

why not to use gradle scripts to integrate with external modules that you add to your project.

您确实使用gradle脚本与外部模块集成"或您自己的模块.

You do "use gradle scripts to integrate with external modules", or your own modules.

但是,Gradle不是IntelliJ IDEA的本机项目模型—.它们分别保存在 .iml 文件和 .idea/目录中的元数据中.在Android Studio中,这些内容大部分是由Gradle构建脚本生成的,这就是为什么当您更改诸如 build.gradle 之类的文件时有时会提示您与Gradle文件同步项目"的原因.这就是为什么您不必费心将 .iml 文件或 .idea/放在版本控制中,因为它们的内容将被重新生成.

However, Gradle is not IntelliJ IDEA's native project model — that is separate, held in .iml files and the metadata in .idea/ directories. In Android Studio, that stuff is largely generated out of the Gradle build scripts, which is why you are sometimes prompted to "sync project with Gradle files" when you change files like build.gradle. This is also why you don't bother putting .iml files or .idea/ in version control, as their contents will be regenerated.

如果我有一个在不同的IDE(例如Eclipse和AS)中工作的团队,如何使项目IDE不可知?

If I have a team that work in different IDE's like Eclipse and AS how to make project IDE agnostic?

在很大程度上,你做不到.

To a large extent, you can't.

欢迎您有一个使用Eclipse风格的目录结构(例如,资源和清单根目录中的清单)的Android项目.您可以通过 build.gradle 教Gradle如何在该结构中查找文件.但是,其他元数据( compileSdkVersion ,依赖项等)将几乎不那么容易复制.

You are welcome to have an Android project that uses the Eclipse-style directory structure (e.g., resources and manifest in the project root directory). You can teach Gradle, via build.gradle, how to find files in that structure. However, other metadata (compileSdkVersion, dependencies, etc.) will not be nearly as easily replicated.

其他替代方法包括:

  • 将所有人转移到另一个构建系统(如Maven),该构建系统已同等地集成到Eclipse和Android Studio中(或视您的观点而定)

  • Move everybody over to another build system, like Maven, that is equally integrated (or not, depending upon your perspective) to both Eclipse and Android Studio

希望 Andmore 很快就会开始普及,以便也许您可以拥有一个可以从Gradle构建脚本构建Android项目

Hope that Andmore takes off soon, so that perhaps you can have an Eclipse IDE that can build Android projects from Gradle build scripts

每个人都使用一个IDE

Have everyone use one IDE

这篇关于什么是Android Studio中的.iml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆