新建的Android项目无法运行main函数,出现如下错误
9:52:25: Executing task 'HH.main()'...
Executing tasks: [HH.main()] in project E:\DemoC\TestDemo
FAILURE: Build failed with an exception.
* Where:
Initialization script 'C:\Users\Administrator.SC\Local\Temp\HH_main__.gradle' line: 21
* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:HH.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 0s
9:52:25: Task execution finished 'HH.main()'.
解决方案:修改.idea--->gradle.xml中添加 <option name="delegatedBuild" value="false" />重新Rebuild Project就可以