3

I have been trying to understand how Android Studio IDE works by trying out a few things. I imported one of the sample projects –– Android DataLayer –– from Google repo, and it came with a few configured modules. Then I deleted the .idea folder and wanted to open the project again, but in the sidebar panel, all I see is emptiness.

enter image description here

What can I do to recreate the project?

picardo
  • 24,530
  • 33
  • 104
  • 151

2 Answers2

5

Try syncing the project with "Tools" > "Android" > "Sync Project with Gradle Files".
If nothing changes when that process seems to be completed, then close and reopen the IDE.

If that still does not help:

  • Close the project via "File" > "Close Project"
  • Go into the project directory and delete the file .iml
    (using your development machine's file manager e.g., Nautilus in Ubuntu, Finder in OS X).
  • Then, import the project using "Import Non-Android Studio Project" from the welcome dialog that appeared when you closed the project earlier.
Ola Ström
  • 4,136
  • 5
  • 22
  • 41
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Synchronizing didn't work, but importing the project again almost worked. I saw the project modules for a split second before they were gone again. The build.gradle file is empty at the top level of this project –– the submodules have their own gradle files. Could that be the cause of the problem? – picardo Feb 03 '15 at 22:34
  • @picardo: It depends on whether the `build.gradle` files are complete (e.g., have a `buildscript` closure), and whether you have a `settings.gradle` file at the top level or not. – CommonsWare Feb 03 '15 at 22:36
  • Yes, to all those. When I find the project folder and click ok, nothing happens. The welcome dialog doesn't go away. The IDE doesn't open up. It's weird. – picardo Feb 03 '15 at 22:40
  • @picardo: You could try repeating the process from the second paragraph of my answer, but also get rid of the `build/` directory (if you have one at the top and/or module levels) and the `.gradle/` directory. That's my basic recipe for making a clone of a project: delete `.idea/`, `.iml`, `build/`, and `.gradle/` of a project copy, then import the pruned copy. – CommonsWare Feb 03 '15 at 22:46
  • I figured out that when I select the project, it creates an `.idea` folder, but it doesn't open the project. But I can open it from the commandline, which is good enough for me. :) – picardo Feb 03 '15 at 23:05
0

Try creating a new project with exactly the same name, packageName etc. and then copy the folder from the new project into your old one

Nickolaus
  • 4,785
  • 4
  • 38
  • 60