Reputation: 133
I installed new Android Studio and created a new project. I asked the wizard to create a main activity. However, there were no layouts, no main activity class, no nothing. I got an error when trying to make new Java class files. The new project tree looks like:
No (main/java) folder.
No (res/layout) folder.
Other words project is useless.
Upvotes: 11
Views: 21639
Reputation: 11
I created a new activity by right clicking on java then selected activity and the layout file was automatically written
Upvotes: 1
Reputation: 91
Choose "Empty Activity" instead of "No Activity",
while creating a NEW PROJECT
in Android Studio.
Upvotes: 4
Reputation: 1
Try
Typing main activity
(without quotes) in the search box and
Press enter.
For me it got restored. Search window is useful in finding many hidden tools quickly.
Upvotes: 0
Reputation: 19
I found it's because I changed the Java runtime version before through the Android Studio plugin Choose Runtime
. I changed to JDK 8 from JDK 11 then the problem occured. It worked for me to change back to JDK 11 through plugin Choose Runtime
.
Upvotes: 0
Reputation: 1
When you open a new project, you can't select "empty project" you have to select and activity project. I just went through this had to delete my project and start a new one now everythings there.
Upvotes: -1
Reputation: 1
I don't know if anyone is having the same problem right now but i solved this issue by changing the Android Gradle plugin version and the Gradle version.
For doing this you have to open the project you're having issues with and click on
File->Project Structure->Project
and there you will see the two options.
Android Gradle Plugin Version 4.0.0 and Gradle version 6.1.1 worked for me. After that I went to the file directory, right click on the package folder "com.example.myProject" and manually created an empty activity. The layout folder with my new activity was created automatically after that.
Upvotes: 0
Reputation: 2587
After creating the project, you need to go to File menu and then Import Project. Then browse to the location of your project and import it. Then you will see all of these files and folders. I had this problem too, and it seems to be something that they overlooked in the newer versions of Android Studio (which is quite pathetic if you ask me).
Upvotes: 6
Reputation: 105
From what i learned is that you may be picking the "no layout" option when prompted to pick one. Try picking the basic activity and the rest of the files will show
Upvotes: 8