Windows 11 系统 Android Studio 从低版本升级到 Android Studio Electric Eel | 2022.1.1 Patch 1 结果构建报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ flutter run Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Using hardware rendering with device sdk gphone x86 64 arm64. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on sdk gphone x86 64 arm64 in debug mode... FAILURE: Build failed with an exception. * What went wrong: The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: D:\Program Files\Android\Android Studio\jre\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 'assembleDebug'... 6.3s Exception: Gradle task assembleDebug failed with exit code 1 |
原因为 Android Studio Electric Eel | 2022.1.1 Patch 1 安装目录下存在 jre 文件夹的残留,需要移除这个残留目录即可解决问题。