Visual Studio 2017中找不到Zipaligner,需手动安装吗?
Hey there! Let's work through why you can't locate zipaligner even though it's supposed to ship with the Android SDK. Here's what to check step by step:
First, confirm zipaligner's actual installation path
Zipaligner comes bundled with every version of Android Build Tools, not the core SDK itself. You’ll find it nested in your Android SDK directory at:Android SDK\build-tools\<specific-build-tools-version>\zipaligner.exe
For example, if you have Build Tools 28.0.3 installed, look inbuild-tools\28.0.3\.Find your Android SDK path in Visual Studio 2017
If you’re unsure where your SDK is installed, open Visual Studio and navigate toTools > Options > Xamarin > Android Settings. The "Android SDK Location" field will show you the exact folder. Head there and check thebuild-toolssubfolder—you should see at least one version folder containing zipaligner.Verify Build Tools are installed
If thebuild-toolsfolder is empty or missing the version you need, open the Android SDK Manager viaTools > Android > Android SDK Manager. Go to the "SDK Tools" tab, make sure at least one version of "Android SDK Build-Tools" is checked, then click "Apply" to install it. Zipaligner will be included automatically with the installation.Fix zipaligner not running in Package Manager Console
The Package Manager Console relies on your system’s PATH environment variable. Since zipaligner’s folder isn’t added to PATH by default, the console can’t locate it. You have two simple fixes:- Add the path to system PATH: Open your system’s Environment Variables, edit the "Path" variable, and add the full path to the
build-tools\<version>folder that contains zipaligner. Restart Visual Studio after making this change. - Run it using the full file path: Instead of just typing
zipaligner, use the complete path in the console, likeC:\Android\sdk\build-tools\28.0.3\zipaligner.exe.
- Add the path to system PATH: Open your system’s Environment Variables, edit the "Path" variable, and add the full path to the
Why Keytool works but zipaligner doesn’t
Keytool is part of your JDK installation, and the JDK’sbinfolder is typically added to your system PATH during setup. That’s why you can run it directly—zipaligner just needs the same PATH configuration to be accessible globally.
内容的提问来源于stack exchange,提问作者Eugene

