提问者:小点点

我无法构建 apk 颤振应用程序。 Java 错误:提供的 javaHome 似乎无效 [重复]


我想在手机中测试我的flutter应用程序。所以我尝试构建一个apk。我在应用程序文件中运行了这个:

flutter build apk --split-per-abi

结果:

 Building with sound null safety


FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jre1.8.0_51\bin\java.exe

* 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
Running Gradle task 'assembleRelease'...                            4,0s
Gradle task assembleRelease failed with exit code 1

如果我理解正确,它找不到Java。因为 C:\Program Files\Java\jre1.8.0_51\bin 路径为空。我尝试卸载并重新安装Java,但结果是一样的。如何解决此问题并在手机中构建用于测试的apk?


共1个答案

匿名用户

您只安装了 Java JRE(java运行时环境)。安装完整的java SDK。在环境变量中添加SDK路径作为JAVA_HOME变量。