AS运行main()方法报错:SourceSet with name ‘main‘ not found

AS运行main()方法报错:SourceSet with name ‘main’ not found

记录一下在AS上运行Java文件的main()方法时报错,报错如下:
AS运行main()方法报错:SourceSet with name ‘main‘ not found解决方法:在.idea文件夹下的gradle.xml文件中添加<option name="delegatedBuild" value="false" />,然后重新运行就可以了
AS运行main()方法报错:SourceSet with name ‘main‘ not found