git 每个模块必须有一个唯一的路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38629692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:08:41  来源:igfitidea点击:

Each module has to have a unique path

androidgitandroid-studio

提问by Compaq LE2202x

I have imported a project from version control using GIT. After importing, syncing and all that, it gave me this error:

我已经使用 GIT 从版本控制中导入了一个项目。在导入、同步和所有这些之后,它给了我这个错误:

Error:The modules 'LinkedCraftMobile', 'linkedcraft_android' point to same directory in the file system. Each module has to have a unique path.

错误:模块“LinkedCraftMobile”、“linkedcraft_android”指向文件系统中的同一目录。每个模块都必须有一个唯一的路径。

I wanted to have a module that can be updated directly with GIT using Android Studio.

我想要一个可以使用 Android Studio 直接使用 GIT 更新的模块。

采纳答案by VonC

It could be because of a .gitmodulesincluding two entries with the same paths, but square/assertj-android issues 174points out to another file:

这可能是因为.gitmodules包含两个具有相同路径的条目,但是square/assertj-android 问题 174指向另一个文件:

This usually is the result of old imlfiles. Delete them all and re-import.

Weird, removing the .imland reimporting worked.

这通常是旧iml文件的结果。将它们全部删除并重新导入。

奇怪的是,删除.iml并重新导入工作。

回答by codingjeremy

The best way to fix the .iml files (by recreating them) is to do this:

修复 .iml 文件(通过重新创建它们)的最佳方法是执行以下操作:

  1. Close the project in Android Studio
  2. In Android Studio, New > Import Project
  1. 在 Android Studio 中关闭项目
  2. 在 Android Studio 中, New > Import Project

That fixed it for me, and it was a lot easier than the other stuff I tried (and a lot less complex).

这对我来说修复了它,它比我尝试的其他东西容易得多(而且也不那么复杂)。

I believe that rewrites the .iml files with you do that.

我相信与您一起重写 .iml 文件。

What did I try? I tried Build > clean/rebuild project, File > Invalidate caches/restart, and Sync Project with Gradle Files. I was going to manually erase my .iml files but then I found out about this solution and it worked.

我尝试了什么?我试过Build > clean/rebuild project, File > Invalidate caches/restart, 和Sync Project with Gradle Files。我打算手动擦除我的 .iml 文件,但后来我发现了这个解决方案并且它起作用了。

回答by Sayan Manna

The best way to fix this problem is:

解决此问题的最佳方法是:

Go to Tools-> Android -> Sync Project with Gradle Files

转到工具-> Android -> 将项目与 Gradle 文件同步

That works for me.

这对我行得通。

回答by EKN

This is because of .iml file conflict, For fixing the issue you just need to clean the project and rebuild.

这是因为 .iml 文件冲突,为了解决这个问题,你只需要清理项目并重建。

回答by upRan

In my project settings.gradle,there's a "rootProject.name" attribute assigned,but it does't equals with my project name.I modified this attribute with my project name,then the error message dismissed.

在我的项目 settings.gradle 中,分配了一个“rootProject.name”属性,但它不等于我的项目名称。我用我的项目名称修改了这个属性,然后错误消息消失了。

回答by Dhruvisha

I have same issue , and i tried bulid >clean / rebulidand Tools > Androdi > sync project with gradle filebut it doesn't works for me.

我有同样的问题,我试过了 bulid >clean / rebulidTools > Androdi > sync project with gradle file但它对我不起作用。

and then I tried File >Invalidate Caches / Restart ...and it is works for me .

然后我尝试了File >Invalidate Caches / Restart ...,它对我有用。

enter image description here

在此处输入图片说明