在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>标签节点下添加一行
<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">标签节点并在之下添加一行
<property name="dynamic.classpath" value="true" />
然后保存即可。
文章讲述了在AndroidStudio中遇到的关于main()方法执行错误,包括配置问题和命令行过长引发的解决方案。首先,需要在.gradle.xml中设置delegatedBuild为false;其次,对于过长的命令行,需在workspace.xml中调整dynamic.classpath属性。

686

被折叠的 条评论
为什么被折叠?



