How to import a gradle built module as depencency in Android Studio?
I have also ran into same kind of issue. For me the problem is because i already imported the module. When you importing the module first time it will create a folder inside the project directory named which you entered on the importing window. So when i try to import it again using the same name it will produce the error "Project already contains module with this name". Because there is already a folder with the similar name is there. So to resolve this you need to first delete the folder which already imported from the project directory. And its is not the fine way to renaming the build.gradle.
I know the answer is too late. Hope it will help somebody.
Faced similar issue issue("Project already contains module with this name") while importing an existing android gradle project as a a new module.
Noting down How do I fixed it(may be helpful to you or somebody else).
Issue: When I import an existing android gradle project to my current android project, its shows "Project already contains module with this name". Yes, the "app" module is present in the current project the importing gradle project.
How to fix it:
- Go to New Module->Import Gradle project-> select the gradle project, if current project has "app" module then it says "Project already contains module with this name"
- Check "import" and edit the module name "app" to "your-module-name" and finish. This will import the gradle project with new module name.
Go to the build.gradle of your newly imported module and update the "apply plugin" from,
apply plugin: 'com.android.application'
to
apply plugin: 'com.android.library'
Also, if the newly imported module's build.gradle has the "applicationId", then remove it.Your application ID shall be the main "app" module's application id. Library projects cannot set applicationId. Note: If you have used the applicationId(package name) to start an activity or bind service at the imported project, you have to update it with the the application package name.
Go to the project structure, and import the module as a dependency. then clean project, rebuild. done.