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
- SDK:
- 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 Buildstep, click Add Build Step and selectAndroid Buildfrom the dropdown - Ensure the
Deploy to Android devicestep comes after theAndroid Buildstep - For the deploy step, make sure
USB Deviceis selected as the target
- If there's no
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
sdkmanagerin 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/AndroidSDKANDROID_NDK_HOME=/opt/AndroidNDKJAVA_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:
- Create
/etc/udev/rules.d/51-android.ruleswith this content (replaceYOUR_VENDOR_IDwith your Karbon Titanium's USB vendor ID—you can find it vialsusb):SUBSYSTEM=="usb", ATTR{idVendor}=="YOUR_VENDOR_ID", MODE="0666", GROUP="plugdev" - Reload udev rules:
sudo udevadm control --reload-rules && sudo udevadm trigger - Disconnect and reconnect your phone, then run
adb devicesagain
- Create
内容的提问来源于stack exchange,提问作者user9392253
相关产品推荐
相关产品推荐

