10

I installed new Android Studio. I created new Project and asked the wizard to create main activity. But there were no layouts, no main activity class, no nothing. Error on trying to make new Java class files. The new project tree looks like this:
No (main/java) folder.
No (res/layout) folder.
Other words project is useless.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Pavel Masyuk
  • 123
  • 1
  • 1
  • 8

8 Answers8

7

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

Mohammad
  • 95
  • 2
  • 9
6

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

Zoe
  • 27,060
  • 21
  • 118
  • 148
uSeRnAmEhAhAhAhAhA
  • 2,527
  • 6
  • 39
  • 64
4

Empty Activity

Choose "Empty Activity" instead of "No Activity", while creating a NEW PROJECT in Android Studio.

anonymous
  • 81
  • 3
1

I created a new activity by right clicking on java then selected activity and the layout file was automatically written

Scarra
  • 11
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 07 '22 at 09:29
0

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.

0

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.

0

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.

ecm
  • 2,583
  • 4
  • 21
  • 29
sam
  • 1
-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.

jazz
  • 1