问题
I had successfully imported a Module
in my Application project in Android Studio
.
Then I deleted or removed the module by following the below link:
How to delete a module in Android Studio
I also removed the project module from the dependencies
of my build.gradle(app)
file.
Now, When I need to again include the same module project in my Andorid Application, it doesn't allows me, and gives the Project already contains module with the same name
error.
I had check in my Project, Package, Android
Structure but the project module which i need to Import and add as a Module Project is not there but still it say it already exist.
Can anyone help me to overcome this issue.??
回答1:
If somebody faces this issue, except removing the Folder containing the old module also remove from the settings.gradle
file the line corresponding to the old module: include ':youroldmodule'
. If you dont remove that line manually, 2 modules with the same name will appear when trying to add module dependency.
回答2:
I have encountered this. And I deleted the folder which below my project with the module name I set before, then I can import a module with same name again.
Hope this helps you.
回答3:
I solved the problem through this way:
- Open Module Settings(Mac: command + down; Windows: F4) and delete the module.
- Delete the module folder on the disk. You will find it at ~/AndroidStdioProjects/YourApplicationName/ModuleName.
- Import the Module.
回答4:
The project view on the left hand side, doesn't show 'everything' your project contains. You can switch the view from the drop-down menu, which is defaulted to 'Android' and change it to 'Project Files', which will probably show you where the problematic reference to the Module remains.
Alternatively, just check on disk where your project is located. I found references in the main project folder.
回答5:
You can't import a module if you've put the code for the module in the place it will end up being copied to. I had the module source code placed in the project root folder and it failed to import with the above message. If you move the code away somewhere, on import Android Studio will copy the code in.
回答6:
Remove compile project(':module_name') from build.gradle under app folder
then remove module folder under your Project Folder
then remove your module name entry from settings.gradle
回答7:
I am Not Sure but I hope it's Help you.
Step 1: Pressed Alt + 1 for get Focus of your App.
Step 2: Now Pressed F4 for open Module structure of Project
Step 3 Now Select Dependencies and Remove All Extra dependencies of your project.
than Pressed OK.
and Resync gradle.
I hope you are clear with my solution.
Best Luck
回答8:
I had this problem when I was trying to add junit 4.12 to my project.First of all I delete old junit codes in dependencies of my build.gradle(app) file manually.Next I deleted the old junit.jar from my library with deleting libs folder and then create new libs folder directory in my app for add library.and for the end.......I find the old junit FILE near the end of project view after gradle folder....you can see in this image......and I deleted it.now I can add new module very easy and without same name error.sorry for bad english!! look this image for last order
回答9:
I solved this by removing the existing module from the project structure, then renaming the folder. It finally worked when I removed the folder, ran a sync, then re-added the folder and attempted to import.
回答10:
In one condition if you have copy a folder like this
rootProject/module1
if you import module android studio will find if you have same name folder. if you have it is not import android studio will tell you you have contains this module ,you just add this in setting.gradle like
include ':modlue1'
回答11:
If shows this error after deleting the module from project structure then, select Project view of our project in android studio and then explore and the there will be the folder of module that we imported, right click on that and Delete it and rebuild the app.
回答12:
If any of the above answers worked for you and you are sure that your branch is clean then close your Android Studio, browse to the root of your project and delete .idea
folder. Then re-launch Android studio and run your project.
回答13:
This worked for me:
In app/build.gradle
, remove this line from dependencies {
:
implementation project(':library')
In settings.gradle
, change
include ':app', ':library'
to
include ':app'
Then you can import the library. Be sure to put the lines back into the gradle files you took out above.
来源:https://stackoverflow.com/questions/33172065/project-already-contains-module-with-this-name-android-studio