22

在我们的项目中,我们已将 .idea/codeStyles/Project.xml 提交到源代码控制中,目的是在项目的所有贡献者之间强制执行通用样式,而不会影响其他项目的样式。

但是,Android Studio 似乎对此文件进行了不必要的更改。

从 git 中提取最新代码,然后简单地打开 Android Studio 然后检查git status会产生:

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   my-project/.idea/codeStyles/Project.xml

no changes added to commit (use "git add" and/or "git commit -a")

它所做的更改如下所示: 在此处输入图像描述

如您所见,它正在删除一些 XML 格式设置。

我正在运行 Android Studio 3.5,但我不能保证其他所有人都在运行,并且我们希望保持项目与 IDE 版本无关。

有没有办法阻止 Android Studio 更改这些设置?有没有更推荐的方法来实现统一的代码风格?

4

0 回答 0