Home>

When I try to run in Android Studio, I get the following error message:

14:59:41: Executing task'Test1.main ()' ...
Executing tasks: [Test1.main ()] in project C: \ Users \ ○○ \ AndroidStudioProjects \ MyApplication1
Starting Gradle Daemon ...
Gradle Daemon started in 2 s 829 ms
FAILURE: Build failed with an exception.
* Where:
Initialization script'C: \ Users \ ○○ \ AppData \ Local \ Temp \ Test01_main__.gradle' line: 21
* What went wrong:
A problem occurred configuring project': app'.
>Could not create task': app: Test1.main ()'.
   >SourceSet with name'main' not found.
* Try: Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
14:59:55: Task execution finished'Test1.main ()'.
Corresponding source code

java

public class Test1
{
    public static void main (String [] args)
    {
        System.out.print ("Hello World");
    }
}
What I tried

After getting this error, I tried to recreate the project or reinstall Android Studio, but I get the same error.

Supplementary information (FW/tool version, etc.)

The version of Android Studio is 4.0.1.