美文网首页
AS无法执行Java类的main方法问题及解决方法

AS无法执行Java类的main方法问题及解决方法

作者: 牧区叔叔 | 来源:发表于2020-10-21 09:36 被阅读0次
    FAILURE: Build failed with an exception.
    
    * Where:
    Initialization script 'C:\Users\eerdunsang\AppData\Local\Temp\MyTest_main__.gradle' line: 21
    
    * What went wrong:
    A problem occurred configuring project ':app'.
    > Could not create task ':app:MyTest.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 9s
    9:10:31: Task execution finished 'MyTest.main()'.
    

    解决方法:
    在.idea文件夹下的gradle.xml文件中 <GradleProjectSettings>标签下添加<option name="delegatedBuild" value="false" />,然后重新运行就可以了

    <option name="delegatedBuild" value="false" />

    image.png

    相关文章

      网友评论

          本文标题:AS无法执行Java类的main方法问题及解决方法

          本文链接:https://www.haomeiwen.com/subject/igrsmktx.html