在studio中想要测试某个功能直接执行main()方法报错如下:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app: **** .main()'.
> SourceSet with name 'main' not found.
解决方案:
-
- 执行run ** main() with Coverage;
-
- 修改.idea下的gradle.xml
<GradleProjectSettings>
标签节点下添加一行
xml
<option name="delegatedBuild" value="false" />
保存,即可使用run ** with main() 和 debug ** with main()
错误: Command line is too long. Shorten command line for **
有人在上面盖了gradle.xml之后运行main方法又报如下错误:
Error running ' ** ': Command line is too long. Shorten command line for ** or also for Application default configuration.
解决方案:
修改.idea
下的workspace.xml
找到<component name="PropertiesComponent">
标签节点并在之下添加一行
xml
<property name="dynamic.classpath" value="true" />
然后保存即可。