在Android Studio中找不到MainActivity.java

时间:2022-01-11 20:53:40

I am currently writing an Android App using Android Studio 1.2. However, i cannot find MainActivity.java file in it.

我目前正在使用Android Studio 1.2编写Android应用程序。但是,我找不到MainActivity.java文件。

Hope someone can help me out.

希望有人可以帮助我。

Thanks in advance.

提前致谢。

Regards, Al

4 个解决方案

#1


Its not necessary that your file is named MainActivity.java. That is the default name. If you created the Java file with another name while making the project then that will be your main Activity file. It will have the name you gave while making the project.

您的文件不必命名为MainActivity.java。这是默认名称。如果您在制作项目时使用其他名称创建了Java文件,那么这将是您的主要活动文件。它将具有您在制作项目时给出的名称。

Otherwise just create a new activity and enter its name in the Manifest file to make it the main activity.

否则,只需创建一个新活动并在Manifest文件中输入其名称,使其成为主要活动。

#2


I have Android Studio 1.2 too. In the left side:

我也有Android Studio 1.2。在左侧:

  • Choose 1: Project if it isn´t already open.
  • 选择1:项目(如果尚未打开)。

  • Then choose app, then java.
  • 然后选择app,然后选择java。

  • Then choose com.username.project.
  • 然后选择com.username.project。

  • Finally choose MainActivity.java.
  • 最后选择MainActivity.java。

#3


When you create new project select Blank Activity. MainActivity file is in Android -> app -> java -> your.package.name

创建新项目时,选择空白活动。 MainActivity文件位于Android - > app - > java - > your.package.name中

#4


Inside of android folder navigate to

在android文件夹里面导航到

app --> src --> java --> com --> "your app name"

app - > src - > java - > com - >“你的应用名称”

#1


Its not necessary that your file is named MainActivity.java. That is the default name. If you created the Java file with another name while making the project then that will be your main Activity file. It will have the name you gave while making the project.

您的文件不必命名为MainActivity.java。这是默认名称。如果您在制作项目时使用其他名称创建了Java文件,那么这将是您的主要活动文件。它将具有您在制作项目时给出的名称。

Otherwise just create a new activity and enter its name in the Manifest file to make it the main activity.

否则,只需创建一个新活动并在Manifest文件中输入其名称,使其成为主要活动。

#2


I have Android Studio 1.2 too. In the left side:

我也有Android Studio 1.2。在左侧:

  • Choose 1: Project if it isn´t already open.
  • 选择1:项目(如果尚未打开)。

  • Then choose app, then java.
  • 然后选择app,然后选择java。

  • Then choose com.username.project.
  • 然后选择com.username.project。

  • Finally choose MainActivity.java.
  • 最后选择MainActivity.java。

#3


When you create new project select Blank Activity. MainActivity file is in Android -> app -> java -> your.package.name

创建新项目时,选择空白活动。 MainActivity文件位于Android - > app - > java - > your.package.name中

#4


Inside of android folder navigate to

在android文件夹里面导航到

app --> src --> java --> com --> "your app name"

app - > src - > java - > com - >“你的应用名称”