How does Android studio run the Java main method

1. In the Android studio project, create a new Java class file RunMain.java

public class RunMain {
    public static void main(String[] args) {
        System.out.println("hello world!");
    }
}

2. Find the gradle.xml file in the .idle directory of the project, and open the file. Add a sub-item to GradleProjectSettings: <option name="delegatedBuild" value="false"/>

After the setting is complete, close the gradle.xml file, return to the RunMain.java window, and click main() to run main() normally

3. As a result, output "hello world!" under Run

Guess you like

Origin blog.csdn.net/github_27263697/article/details/131747388