Android studio 编译时出现如下错误
Error:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithStackFramesFixerForRelease'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: java.util.zip.ZipException: error in opening zip file
* 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 0s
其实是让你去查看更多的log信息。找到terminal
输入如下命令:
gradlew compileDebug --stacktrace
如果上面的命令不管用,可以使用下面的命令试试
gradle compileDebug --stacktrace
可以看到很多错误的信息输出出来。
我的错误是JAVA_HOME路径错误 如下所示:
ERROR: JAVA_HOME is set to an invalid directory: D:\Program Files\Java;
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
打开环境变量看到JAVA_HOME后面有个分号
因篇幅问题不能全部显示,请点此查看更多更全内容