Android studio 出现错误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.
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后面有个分号

双击打开是这样的,看不到分号

选择编辑文本

删除掉分号,然后确定保存
问题解决
在Android Studio中遇到编译错误,提示`JAVA_HOME`路径设置不正确。错误信息显示JAVA_HOME指向了无效目录,并提示需要删除环境变量中的分号。通过检查环境变量,发现JAVA_HOME后确实存在无效的分号。删除分号并保存后,问题得到解决,成功编译。
1万+

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



