56

I follow all the necessary steps for Android Studio installation. I also checked this question, but still facing the same issue.

But whenever I create any new project, following screen come. I couldn't found any project structure as I can see in Eclipse.

enter image description here

Here, I can't find any "src","res" or any file structure. Any idea, how to get proper Project Structure?

when I tried to add "New Module" following error comes to submit.

No message
java.lang.IllegalStateException: 
at com.android.tools.idea.wizard.NewModuleWizard.onFailure(NewModuleWizard.java:159)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:340)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$1.run(ExternalSystemUtil.java:364)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:493)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:304)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:185)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:175)
at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:695)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:458)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:154)

When I go to Edit Configuration, can't create any module due to above error.

enter image description here

Community
  • 1
  • 1
Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93

12 Answers12

57

Go to File > Project Structure > Project Settings > Modules.

Click on the green colored + and add new module. select Application module and set the content root to your project module.

Click next and then finish.

This should do the trick and the complete project structure will appear. It worked for me.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
Maddy
  • 586
  • 5
  • 3
  • 1
    I fixed the issue without manually creating a module. See my answer. – theblang Oct 23 '13 at 19:53
  • Select 'import module from existing source (not the exact words)` when you will be prompted to choose from 'create a new module and above option as radio buttons. – Darpan Jul 20 '15 at 05:50
  • In Android Studio 2.3.1, you don't have the Application module option if you wanted to add a module. For that version got to have a different solution.... See my reply below. – J D Apr 18 '17 at 04:23
  • this option is not displayed on my Android Studio – Dani Feb 21 '20 at 14:38
9

Change the SDK to a level that you have installed in the SDK manager. The SDK manager can be accessed from Tools -> Android -> SDK Manager. For me, Android Studio was packaged with API Level 17 but the new project wizard tried to target API Level 18.

theblang
  • 10,215
  • 9
  • 69
  • 120
9

When something like that happens to me, to fix it, I go to

File -> Project Structure -> Modules, click (+) to add a module.

To import the main module you have to search for the IML extension file to load the project structure configuration again (for example app.iml), and thats all. I hope it helps.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
Mr.Moustard
  • 1,297
  • 21
  • 24
5

Kip2's solution worked for me with a slight variation:

1.) File -> Invalidate Cached/Restart..

once android studio restarts:

2.) File -> Sync Project with Gradle Files


Just doing "File -> Sync Project with Gradle Files" (or doing "File -> Sync with File System"), did not correct the problem. I had to invalid the cache first, and then sync the project with gradle files for the project to display properly.

Tom Rutchik
  • 1,183
  • 1
  • 12
  • 15
  • I've got one project that keeps getting this problem and I've learned since my posting that most of the times "File -> Sync with File System" is correcting the problem. I'll add that at least one time, that wasn't sufficient and I had to invalidate cache first. Now I got to figure out why this one project seems to get in that state quite regularly. – Tom Rutchik Oct 08 '18 at 23:00
  • this option is not displayed on my Android Studio – Dani Feb 21 '20 at 14:37
  • File->Sync with File System has been removed in a later versions of Android Studio. I think it now called Reload All from Disk. – Tom Rutchik Oct 09 '20 at 15:22
3

Finally find solution.

Whenever Android Studio starts, it search for "Gradle" installation. If not found, it will download new version of it and cache it here.

C:\Documents and Settings\user\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok

Here 72srdo3a5eb3bic159kar72vok directory name may be different.

What you need to do is, download gradle-1.6-bin.zip, place it in above directory. Then decompress it there. But make sure your path should like below.

C:\Documents and Settings\crathod.SOLUSOFTINDIA\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\gradle-1.6\bin

Now, when you restart your Android Studio, Gradle will be initialized and Project will opened in Full Project Structure.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
  • I did as you said, but it's not help me at all. :( Where I can see any inforation about this gradle build version? – Borys Jun 15 '13 at 10:17
3

Modules or the project structure could also not appear because you're in a branch where *.iml files are missing. This happened for me when I was migrating from Eclipse and had decided to check back into the original branch that had the Eclipse-like project structure. What solved my problem:

  1. Checkout the branch with Android Studio-like project structure
  2. File -> Invalidate Cache & Restart
kip2
  • 6,473
  • 4
  • 55
  • 72
2

Also, make sure that the root iml file matches case with your root folder. Incorrectly named iml file will cause such problems.

Just delete the root iml file (you can backup if you like), close the project and re-open it. Android Studio will generate the correct iml file and the project structure will be restored.

This is tested on Android Studio 2.1

Eren Yilmaz
  • 1,082
  • 12
  • 21
2

Before:

  enter image description here

After:

  enter image description here
  I got the java folder (src folder) and others.

Solution:

  enter image description here

  • File > Sync Project with Gradle Files

Android Studio Version: 3.2.1

Note: This case did not appear on the old version. For example, 1.5.1 (2016/03 before)

Keywords:

  • file explorer
  • file structure
  • file hierarchy
  • file system
  • folder & file list
  • project explorer
  • project structure
  • project hierarchy
  • disappear / gone / did not see
  • Android Studio bug / issue
蔡宗容
  • 927
  • 12
  • 9
  • Is it a common practice to add keywords to an answer ? I'm puzzled – Marcel Falliere Apr 17 '19 at 15:34
  • No, since this case has difference names, sometimes it is hard to find the corresponding Q&A. Hence, I added some keywords to index the Q&A. (For example, a folder in a disk can also be called "dictionary"; "file explorer" in a software can be called "project explorer", etc.) – 蔡宗容 Apr 19 '19 at 06:06
  • "Sync Project with Gradle Files" is what needs selecting if you're trying to get the project structure of your app setup the "Android" way. works in Android Studio v3.4.2 – lasec0203 Jul 22 '19 at 01:56
2

simple way to restore

Delete the project hidden .idea file and .gradle file and restart your project this will fix your issue.

Muhammad Mubeen
  • 153
  • 1
  • 8
1

I deleted the app from the list of apps when you open Android Studio, then I reimported the project.

fullmoon
  • 8,030
  • 5
  • 43
  • 58
0

For Android Studio 2.2, you can simply click the left bottom and then select Project

enter image description here

0

In Android Studio 2.3.1, you don't have the Application module option if you wanted to add a module. The best solution is to right click your project and select "Jump to the source" from the menu. That solved my issue.

J D
  • 274
  • 3
  • 17
  • What do you mean by 'your project'? I right click the parent folder in my project in the Project folder hierarchy but dont see "Jump to the source". Also clicking the Project dropdown above that doesnt help. – Ian Steffy Apr 18 '18 at 12:42