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

Qt Creator中无法运行Android应用:部署步骤报错求助

Fix for "Cannot find the android build step" Error in Qt Creator (Arch Linux)

Let's work through this issue step by step—here are the most likely fixes for that frustrating error when trying to run your Android app:

1. Verify Qt Creator Kit Configuration

First, double-check that your Android kit is properly set up:

  • Open Qt Creator, go to Tools > Options > Devices > Android
  • Confirm the paths for Android SDK, Android NDK, and JDK match your installed locations:
    • SDK: /opt/AndroidSDK
    • NDK: /opt/AndroidNDK
    • JDK: /usr/lib/jvm/default
  • Switch to the Kits tab, find your Android for armeabi-v7a (GCC 4.9, Qt (android_armv7)) kit, and verify:
    • The SDK/NDK/JDK paths are correctly linked to this kit
    • The kit isn't marked as invalid (no red warning icons)

2. Restore Missing Android Build Steps

It sounds like your project's build pipeline is missing the required Android step:

  • Open your project, go to the Projects tab (left sidebar)
  • Switch to your Android kit under Build & Run
  • Look at the Build Steps section:
    • If there's no Android Build step, click Add Build Step and select Android Build from the dropdown
    • Ensure the Deploy to Android device step comes after the Android Build step
    • For the deploy step, make sure USB Device is selected as the target

3. Check NDK/SDK Compatibility

Qt has specific version requirements for Android tools, even if you have the right packages installed:

  • NDK 10e is compatible with most Qt 5.x versions, but confirm your Qt version supports it (Qt 5.7+ works well with NDK 10e)
  • Open the Android SDK Manager (you can launch it from Qt Creator's Android settings or via sdkmanager in your terminal) and install:
    • SDK Platform Tools (latest stable version)
    • Build Tools version 28.0.3 (a reliable version for Qt projects)
    • At least one Android SDK Platform (API level 21-28 is recommended for broader compatibility)

4. Force Qt Creator to Load Your Environment Variables

Sometimes Qt Creator doesn't pick up system-wide environment variables from /etc/environment automatically:

  • Go to Tools > Options > Build & Run > Environment
  • Click Add and manually input these variables:
    • ANDROID_HOME=/opt/AndroidSDK
    • ANDROID_NDK_HOME=/opt/AndroidNDK
    • JAVA_HOME=/usr/lib/jvm/default
  • Restart Qt Creator to ensure the variables take effect

5. Confirm USB Device is Recognized

Even if USB debugging is enabled, your system might not be detecting the phone:

  • Open a terminal and run adb devices
    • If your phone shows up with a device ID and "device" status, it's recognized
    • If not, create a udev rule to fix permissions:
      1. Create /etc/udev/rules.d/51-android.rules with this content (replace YOUR_VENDOR_ID with your Karbon Titanium's USB vendor ID—you can find it via lsusb):
        SUBSYSTEM=="usb", ATTR{idVendor}=="YOUR_VENDOR_ID", MODE="0666", GROUP="plugdev"
        
      2. Reload udev rules:
        sudo udevadm control --reload-rules && sudo udevadm trigger
        
      3. Disconnect and reconnect your phone, then run adb devices again

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 07:10:35