在Android Studio运行Java的main()方法报错,报错如下:
* Where:
Initialization script '/private/var/folders/8q/h900f59d1976bmzmy69ybsq40000gn/T/xx_main__.gradle' line: 41
* What went wrong:
A problem occurred configuring project ':libs'.
> Could not create task ':libs:xxx.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
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
BUILD FAILED in 131ms
解决方法:
在.idea文件夹下的gradle.xml文件中添加<option name="delegatedBuild" value="false" />,然后重新运行main方法就可以了