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

Android构建时无法列出目标平台(Unity 2017.3.1f1)

Fixes for "CommandInvokationFailure: Unable to list target platforms" (Android Release Build)

Hey there, let’s work through this frustrating build issue together. Since you’ve already tried swapping to JDK 8 and older SDK tools without luck, let’s dive into more targeted steps to get your Release build over the line:

  • Validate your SDK path (no sneaky whitespace allowed!)
    Spaces or special characters in your SDK path often break the build tool’s ability to resolve directories. For example, avoid paths like C:\Program Files\Android\SDK—instead use something like C:\AndroidSDK. Double-check that this path matches exactly where your SDK is installed, then test it by running sdkmanager --list in your SDK’s cmdline-tools/latest/bin folder. If this command throws an error, your path is definitely the problem.

  • Install the exact target SDK version your project requires
    Open your project’s build config (like build.gradle or Unity’s Player Settings) and note the target SDK version (e.g., 33). Head to Android Studio’s SDK Manager, go to the "SDK Platforms" tab, and make sure that specific version is checked and fully installed. Build tools can be picky about matching the target platform exactly—don’t assume a newer version will work as a replacement.

  • Refresh your SDK Command-line Tools
    Corrupted or outdated command-line tools are a common culprit. In SDK Manager, go to "SDK Tools", check "Show Package Details", then find "Command-line Tools" and install the latest stable release (skip canary builds). After installing, delete any old cmdline-tools folders in your SDK directory to eliminate conflicts.

  • Double-check your environment variables
    Ensure ANDROID_HOME (or ANDROID_SDK_ROOT) is set to your SDK’s root directory in your system’s environment variables. Also add %ANDROID_HOME%\cmdline-tools\latest\bin and %ANDROID_HOME%\platform-tools to your PATH. Test this by opening a new command prompt and running adb --version and sdkmanager --version—both should run without errors if your variables are set correctly.

  • Wipe cached build files and rebuild from scratch
    Stale cached files can cause weird build conflicts. Delete the build folder in your Android project (or in Unity, use File > Build Settings > Clean), then delete the .gradle folder in your project root. Restart your IDE/Unity and try the Release build again—fresh starts fix more issues than you’d think.

  • Fix permission issues on your SDK directory
    On Windows, right-click your SDK folder, go to "Properties > Security > Edit", and grant your user account full read/write permissions. On macOS or Linux, run chmod -R 755 /path/to/android-sdk to ensure the build tool can access all necessary files.

If none of these steps work, try running the build via the command line instead of the GUI. This will often output more detailed error logs that can point to the exact problem (e.g., missing packages, corrupted files) that the standard error message hides.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 08:48:44