我无法创建apk flutter应用程序,Java错误:提供的javaHome似乎无效

mzsu5hc0  于 2022-12-24  发布在  Flutter
关注(0)|答案(1)|浏览(304)

我想在手机上测试我的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?

z4bn682m

z4bn682m1#

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

相关问题