有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java类文件未在Android Studio上编译或运行

当我试图在Android studio中运行代码时,它不工作,并显示下面附加的错误。例如:

package com.example.jerry;

public class Test {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

运行Java类测试时出错。班以下是显示的错误:

5:06:58 PM: Executing task 'Test.main()'...

Executing tasks: [Test.main()] in project G:\JavaProject\Jerry


FAILURE: Build failed with an exception.

* Where:
Initialization script 'C:\Users\Shakil\AppData\Local\Temp\Test_main__1.gradle' line: 21

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:Test.main()'.
   > SourceSet with name 'main' not found.

* 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 271ms

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
5:06:58 PM: Task execution finished 'Test.main()'.

共 (0) 个答案