5

I've a big problem with Android Studio. I have a project that depends on two other projects (as libs). I followed the guide Problems importing project into Android Studio regarding ActionBarSherlock for import external modules. I opened "Project Structure", imported the module, but after that I can't see it in the Modules area. The Modules area contains only the root module, seems it is not refreshed (this is strange). So if I try to add the module as a Dependency, Android Studio doesn't find any module!

Then, if I try to re-import the module, it says that the module/project is already registered!! Maybe I'm missing something, but I don't know what....! I have this problem both on Windows and MacOSX.

Thanks in advance, Federico

Community
  • 1
  • 1
Coding4Lif3
  • 51
  • 1
  • 3

5 Answers5

16

Look around in your .idea directory for mentions of the problematic project. I had the same problem and resolved it by deleting the entry from .idea/sbt.xml.

Michael Iles
  • 4,687
  • 2
  • 20
  • 17
  • When trying to import an SBT project, I got the error `"The project is already registered"`, and was able to fix it using this advice. The exact steps I took: 1) Close IntelliJ, 2) Find mentions of a project of the same name in any file in ~/.idea - for me, it showed up in `~/.idea/workspace.xml`, 3) remove the XML blocks that mention it, 4) restart IntelliJ and importing should work. – Yevgeniy Brikman Oct 02 '14 at 22:17
  • 4
    I get that everyone loves Intellij but we shouldn't have to be deleting file entries just to get things to work. – Conner May 31 '16 at 16:22
9

In ij go to menu: View -> Tool Windows-> Gradle Right click on the problematic module and click Refresh External Project, You should see the module in project explorer.

SandeepGodara
  • 1,468
  • 16
  • 12
0

I had a similar problem with ABS and other library imports. The 'Project Structure' interface just wouldn't show the modules. On trying to import the modules, it would prompt, "The project is already registered". Seems to be an IntelliJ/Android Studio issue. Invalidate Caches option didn't help.

Reimporting the project after some cleanup did work for me.

  1. As a precaution, take a backup of your project and store it safely
  2. Ensure that your project builds via gradle command-line and you have all required dependencies specified in respective build.gradle files. Try building with: gradle clean && gradle build
  3. Close the project in Android Studio (or close Android Studio)
  4. Delete .iml files and .idea folders from all modules and the main project
  5. Start Android Studio and reimport the project (Import project from external model > Gradle)
Shirish Kamath
  • 356
  • 4
  • 5
0

you should remove the project from respective gradle/sbt/maven/ant tab (used to be on right vertical line of Android Studio/Intellij IDEA)

See this answer: https://stackoverflow.com/a/30442195/907576

Community
  • 1
  • 1
radistao
  • 14,889
  • 11
  • 66
  • 92
0

My issue was fixed when I restart IDEA.

Ahmet Koylu
  • 159
  • 1
  • 3
  • 14