AndroidStudio报compileMiguDebugJavaWithJavac异常的定位
在Android开发过程中,因为各种不同的原因,Androidstudio总是会报出:Execution failed for task ':main:compileMiguDebugJavaWithJavac’这样的错误,莫名其妙的。
What went wrong:
Execution failed for task ':main:compileMiguDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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.
一百度,各种解决方案琳琅满目。但绝大部分方案总结起来,不外乎以下几种:
1、升级更新buildToolsVersion 到最新版本
2、升级Android Studio 2.2.2版本,JDK 1.8版本
3、配置JAVA_HOME路径
4、修改compilesdkVersion
5、 重启as
6、C盘用户目录下的 .gradle文件夹删除,项目下的 .gradle文件夹删除然后重新编译
当你一一试过上述几种方案后,会发现,做了一堆的无用功。甚至你连报这个错误的原因或者地方都没有发现。很无力的那种感觉,不好受。
其实这里有一种很方便定位到报异常的地方以及原因,那就是在Androidstudio的 Ternimal命令编辑框里面运行以下命令:
gradle compileMiguDebugJavaWithJavac
经过一番运行,就会自动的提示你出问题的地方以及原因。比如:
检查结果会很清晰的告诉你,在哪里除了什么问题,是什么类型的问题。