Android Studio "Project Structure" not coming properly - android

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.
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.

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.

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.

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.

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.

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.

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:
Checkout the branch with Android Studio-like project structure
File -> Invalidate Cache & Restart

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

Before:
  
After:
  
  I got the java folder (src folder) and others.
Solution:
  
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

simple way to restore
Delete the project hidden .idea file and .gradle file and restart your project this will fix your issue.

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

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

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.

Related

Android studio: this project is not gradle based project

I have one project which was initially in eclipse, then i managed somehow to convert it to gradle and everything was working fine in Android Studio.
But then i didn't work some time with the project and after few months when i returned to project i am surprised that Android Studio has problems with this project.
When i selected "Android" from top left dropdown in AS, where you should see the project as Android, i saw no files, then i did something and now i see there one empty folder Java.
If i hit button "sync project with gradle files" AS says message as posted in name of question, but it is gradle based project.. there are gradle files etc.
Do you someone know why is this problem? Why it should stop work like this?
Thank you
Make sure you open the project from its root directory. i.e. the directory which contains the top level build.gradle file.
The missing top level gradle file is what causes this error.
For native Flutter Projects:
Note that this error will also appear if you "sync your project with Gradle files " in the root directory. Gradle works only in your android directory (flutter_name/android).
Configure Gradle version
I got this error because i wanted to change some build values like the Gradle version and the Gradle plugin version (and other build values ex. kotlin):
In your current project: File>Open
Select directory: user/StudioProjects/flutter_name/android
Open directory in a new window
After it is opened it will load some packages (see right bottom), which will take some time.
Under File>Project Structure Project you can set the gradle version and under Modules variables of your build
Now you can sync your project with Gradle files or at least read out the error messages, that come with your configuration
After configuration, you might need to restart your project with File>Invalid Caches/Restart....
That worked for me:
copy the file build.gradle
drop the copied file build.gradle in
your app/project folder .
My project stopped showing all of sudden and already had build.gradle file.
I just reopened it via File > Open.

Android Studio - Android Project View is Missing

I've found some webpage but it does not guide me back to normal android project view.
http://developer.android.com/sdk/installing/studio-androidview.html
I did File => Other Settings => Default Project Structure => Default Settings => OK It make even worse, import library become not function-able.
I also had this problem (creating new project also looked similar to IntelliJ IDEA), got it fixed when I enabled some Android-related plugins.
Go to Preferences (Settings on Windows and Linux) > Plugins and enable Android Support, at a minimum.
Now you will have "Android" option in the Project View.
Try:
View -> Tool Windows -> Project OR the shortcut is alt+1.
If that's not working try:
Window -> Restore Default Layout OR the shortcut is shift+F12.
Also, check that Studio is up to date:
Help -> Check for update...
None of the above solutions worked for me so I fixed this by removing the .gradle and .idea folders from my project.
The square at the bottom left corner of android studio lets you spread the screen or it populates it with side menus.
For me, it happened when I used Kotlin KTS for Gradle files, but created a java library module for this project. After trying to reimport project I got an error:
New Gradle Sync is not supported due to containing buildSrc module
Solution:
Migrate added module to kts
Remove created by Wizard settings.gradle, if you already use settings.gradle.kts
Reimport project
File -> Close project
Android Studio: import project
Show it your current project location
Just had the problem happen to me again. I got the problem solved, but unfortunately I can't confirm the solution, now that it's fix; but I have strong suspicions on what was the cause.
In my case, the problem occurred as a result of reorganizing my project directory. My projects are stored in given directory lets call it "Projects". I renamed that fold to "ProjectsBackup" and created a new "Projects" directory. I then moved selected projects now contained in the "ProjectBackup" directory to the new "Projects" directory. After moving the first project, I used Android Studio to open that project. That's when the problem occurred. I got a message that it couldn't find the gradle-wrapper and offered me the choice to create it. The gradle-wrapper is stored in a directory call "gradle" and its stored in the "Projects" directory. I had not copied that directory over from the "ProjectsBackup" to the new "Projects" directory. At the time, I thought nothing about that since, a new one was created. After trying all the various suggestion in this problem discussion, android studio offered a notification from me to update my "android gradle" plugin. I did the update and after that the "android" view was now available for me to select. The android gradle update fixed the problem.
I unfortunately, can't tell you what changed as a result of the update, nor can I tell you how you can force Android Studio to update or reinstall the android gradle plugin. All I can tell you is that I got lucky that android studio gave me that notification to update the android gradle plugin. Things like "file/project structure" and changing the Android Gradle Plugin Version, didn't fix the problem. What I did notice, was that when I first looked at that, the drop-down list of android gradle versions was an empty list. I manually put one in "3.6.3", but it didn't help. If you run into this problems I would suggest you look at the dates of the two file in the "wrapper" directory and compare those to projects you may have that are working correctly with the android view. I wish I would have checked the date of the wrapper jar file, when it wasn't working. That's what I think might have been wrong (i.e. I got a wrapper.jar file that was incompatible with my version of android studio - unfortunately I can't prove that)
problem solve i have click this button

Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules"

I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every
Unsupported Modules Detected: Compilation is not supported for following modules: . Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
After getting this error AS stop compilation of this module so that I am not able to compile/run my project any more.
1- close the project
2- close Android Studio IDE
3- delete the .idea directory located inside the project folder
4- delete all .iml files
5- open Android Studio IDE and import the project
First of all you should update to Android Studio 1.2
Source: https://code.google.com/p/android/issues/detail?id=77983
Then you should go to File -> Invalidate Caches / Restart -> Invalidate Caches & Restart.
Then try to build the application again.
Invalidate Caches and Restart did not work for me. I also updated all my Android Studio files with no success.
The solution I found was importing the android folder by clicking "Import project (Eclipse ADT, Gradle, etc.)" rather than clicking "Open an existing Android Studio Project" or dragging the folder onto the app icon.
Apparently the problem is caused because a module in the project has an *.iml file that does not contain external.system.id="GRADLE".
When you import the project (as opposed to opening it), the iml files are completely re-written, thus removing the error.
I found the info here: https://issuetracker.google.com/issues/37008041
Goto .idea/modules.xml & delete the invalid/not existing path <module />. Then File => Invalidate Caches / Restart.
Try this if it helps File -> Invalidate Caches / Restart.
If it still doesn't help click on the button in the image.
'Sync Project with Gradle Files'
I know it's an old question. but I faced this problem after updating to Android Studio 3.0. I solved it by deleting app.iml file inside my app module and then Invalidate Caches / Restart.
In my case settings.gradle contained invalid configuration.
I changed:
include ':app'
rootProject.name='<somthing else>'
To:
include ':app'
Error is gone. So maybe check your settings.gradle for potential errors. If this won't work try to remove cache and other tips.
Delete .idea/modules.xml
Reload All Gradle Projects
You do not want to remove entire .idea directory, because it contains e.g. dictionaries and shelved changes.
If the above doesn't help you - check your module .iml file and see if it contains any errors. (for the app module it will be app.iml).
Invalidating caches/Restart didn't worked for me.
But simply deleting the caches folder in \Users\user.AndroidStudio(version)\system worked like a charm
You may resolve by below process:
In Android Studio, go to left panel, switch from Android to Project pane
Expand .idea folder, you can see modules.xml and open the file.
In the modules.xml file, you might see like below:
<component name="...">
<modules>
<module fileurl="file://$PROJECT_DIR$/[check...].iml" filepath="$PROJECT_DIR$/[check...].iml" group="myProject" />
<module fileurl="file://$PROJECT_DIR$/app/[check...]-app.iml" filepath="$PROJECT_DIR$/app/[check...]-app.iml" group="[check...]/app" />
Check that match the module name correctly in module element
And then, sync the gradle file
Close the Android Studio and Move ".idea" Folder and paste it outside Project root folder( For Back up if you need).
Open the Android studio.
On Opening the project it"ll ask add module (app) to your project. You can ignore the same.
It set set default build variant to be "debug".
You can see build variant tab on left corner or hover on "Monitor" Symbol on left bottom
Note: No need to change your .iml file of your project.tom to get build variant option and "Invalidate Cache and Restart" will also not work rather it will clear your history files too!.
I solved a similar problem by closing the project, then re-importing the project (not opening, but re-importing as an eclipse or other project)
Try the below,
Close android studio
Then delete .iml , .idea files
Open again the android studio
Sync with Gradle.
In My Case
I have deleted
android -> .idea Folder
android -> appname.iml file
android -> app -> app.iml file
Open project in Android Studio and no need to File -> Invalidate Caches/Restart
You can do Invalidate Caches / Restart for your case.
The above solution I've tried but didn't work for me.
I deleted the .idea folder from project directory.
Invalidate caches using Android Studio menu File -> Invalidate Caches / Restart
Deleted .gradle folder from user profile directory of Windows 10 operating system. (i.e., C:\Users\YourUserName\.gradle)
Try this solution if the above not working.
You should import the the project
https://issuetracker.google.com/issues/37008041
This error shows up when there is a module in your project whose .iml file does not contain:
external.system.id="GRADLE" Can you please check your .iml files? Also, instead of opening the project, import it, that will completely rewrite your .iml files and you won't see that error again.
Try this steps Individually:-
1) Go to File->Invalidate Caches / Restart.
2) Close android studio, Go to C:\Users\(Your UserName)\.AndroidStudio(version)\system and delete caches folder.
If till now nothing worked, then this step will definitely work...
3) Simply change project location and import project with new location.
Enjoy :-):-)
Step 1 : Delete .iml file
Step 2 : Check if your Project Directory Contain any white spaces if so then Rename your project directory leaving space
ex:
Before : My Project
After rename : MyProject
and open Android Studio...
For windows users, this can also be caused by filesystem corruption.
If all steps above do not correct the error:
Close Android Studio
Open Command Prompt as Administrator
Run a chkdsk /f on the drive your app is stored
Delete .idea folder
Restart Android Studio
save .idea folder somewhere else (for backup)
remove .idea folder
start AndroidStudio
select project
[there may be an error, ignore that]
click File -> Invalidate Caches/ Restart
click button: Invalidate Caches/ Restart
resolved
Delete .idea folder
Close project ->
Reopen Project ->
Invalidate Caches / restart
You can update new version of Android studio then go to invalidate catches/restart.Click sync button build application.
In my case I cloned a git-project where both Java and Kotlin included. Then checked another branch and pressed "Sync Project with Gradle Files". Android Studio 3.0.1.
I had the same issue on androidStudio 3.2 and clonning the project worked for me
In my case it is because the root project name have a space.
So instead of naming it as sample project, it should be sample-project or sample_project.
click File -> Invalidate Caches/ Restart doesn't help you anymore
Delete .iml , .idea files & folders from file explorer not inside android studio
1) Open android studio with different/another project
2) import project newly not from recent
3) build the project again
sure it will work
I had the exact same error and it was so annoying to see the alert every time I stared Android Studio. I tried the solution mentioned above including invalidating cache, restart etc, nothing made it go away.
In my case, we had a module that was deleted from source and the reference also removed from settings.gradle. Turns out, .idea/modules.xml was still referencing that module.
All I needed to do was remove that line from <modules> in .idea/modules.xml and it made it all go away.
I have the same issue. I was tried Invalidate Cache / Restart & also sync project with Gradle Files but still didn't work.
But worked by use the following steps:
upgrading gradle distribution version at gradle.wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
And also Android Gradle Plugin at build.gradle project
classpath 'com.android.tools.build:gradle:4.1.2' //upgrade gradle plugin here
Then Invalidate Cache / Restart
That's all solved my problem. Hope you too
rename project directory fix error for me, android studio 3.4.2

Android Studio - Can't see Java Directory

Created new project in Android Studio on the desktop.
in the Android view in the Project Explorer all looked normal.
Moved the project to a new folder on the desktop and opened it in Studio.
Now in the Android view in the project explorer there is no dropdown icon on the Java directory.
I have invalidated caches, cleaned the project and probably a couple of other things I have forgotten, still cannot see my source files.
I tried both copy and move using file explorer in win7.
I have faced the same issue, although #Igor answers fix your issue, it was different for me because the Java files are missing in the file directory. Same as you, I've also followed the same steps from https://developer.android.com/training/basics/firstapp/creating-project.html and there's nothing special with those steps.
I have resolved the issue by downloading the SDK quck fix in the "Messages Gradle Sync" explorer.
After that, the java folder will appear to the project explorer.
I've faced a similar issue: I could see my java directory in the Android view, but not in the Project view. I finally managed to fix it by going in the menu: File > Sync Project With Gradle Files.
Hope it helps someone.
Your top-level project in Android Studio should show the absolute path of the directory on your machine. Look in the Project perspective (not Android perspective). Like D:\workspace\myproject. Go ahead and navigate into that directory with file explorer on your machine, and make sure that its java sub-directory contains classes!
If you are using a library project , then you need to add below lines in gradle library level
android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
and you need to change the word kotlin to java according to folder name you already have.

Android Studio The project is already registered

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
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.
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.
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.
As a precaution, take a backup of your project and store it safely
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
Close the project in Android Studio (or close Android Studio)
Delete .iml files and .idea folders from all modules and the main project
Start Android Studio and reimport the project (Import project from external model > Gradle)
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
My issue was fixed when I restart IDEA.

Categories

Resources