Android studio run main 方法
就是有时候想快速验证一下代码
Android studio 默认会走gradle构建任务,需要关闭下。
在 .idea 的 gradle.xml 文件,GradleProjectSettings 节点下添加
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<!-- 加这个 -->
<option name="delegatedBuild" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
public class Test {
public static void main(String[] args) {
System.out.println("abcd");
}
}