You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用VS Code在Windows部署Flutter应用?找不到keytool求指导

Fixing "keytool not found" When Deploying Flutter Apps

Hey there! I’ve dealt with this exact headache before when getting ready to deploy a Flutter app, so let’s break down how to get keytool working for you:

1. Check if JDK is installed (and keytool exists)

First, open your terminal/command prompt and run:

keytool -version

If you get an error saying the command isn’t found, that means either:

  • You don’t have a JDK installed, or
  • The JDK’s bin directory isn’t added to your system’s PATH.

2. Install a JDK (if you haven’t already)

keytool comes bundled with the Java Development Kit (JDK). I recommend using OpenJDK (it’s free and widely supported):

  • For Windows/macOS/Linux, you can grab it via your system’s package manager (like sudo apt install openjdk-11-jdk on Ubuntu) or a trusted open-source distributor.
  • After installation, locate the bin folder in your JDK directory (e.g., C:\Program Files\Java\jdk-11.0.18\bin on Windows, /usr/lib/jvm/java-11-openjdk-amd64/bin on Linux).

3. Add keytool to your system PATH

Once you have the JDK’s bin path:

  • Windows: Open System Properties → Advanced → Environment Variables. Find the Path variable, click Edit, and add the full path to the JDK’s bin folder.
  • macOS/Linux: Open your shell config file (.bashrc, .zshrc, etc.) and add this line:
    export PATH="$PATH:/path/to/your/jdk/bin"
    
    Save the file, then run source ~/.zshrc (or your corresponding config file) to apply changes immediately.

4. Use Android Studio’s embedded JDK (if you have Studio installed)

If you already use Android Studio, it includes its own embedded JDK with keytool. Here’s where to find it:

  • Windows: C:\Program Files\Android\Android Studio\jbr\bin\keytool.exe
  • macOS: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/keytool
  • Linux: /opt/android-studio/jbr/bin/keytool

You can either add this path to your system’s PATH, or tell Flutter exactly where to find it with:

flutter config --android-keytool "/full/path/to/keytool"

5. Verify it works

After making these changes, restart your terminal and VS Code, then run keytool -version again. If it shows the version info, you’re good to go—try your Flutter deployment command once more!

内容的提问来源于stack exchange,提问作者SaySomething

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 13:37:31