问题描述
当尝试使用 QT Creator 构建和运行示例项目时,它失败了,提示:
When attempting to build and run an example project with QT Creator, it fails, saying:
Build failed
Warning: Android platform 'android--1' does not exist in SDK.
Building the android package failed!
我找到的所有解决方案都是在 Build Android APK 中选择适当的 Android 构建 SDK,但是该选项的下拉列表显示为灰色:
All the solution I have found say to select the appropriate Android build SDK in the Build Android APK, however the dropdown for that option is grayed out:
当研究这个时,我能找到的唯一解决方案是人们说要确保我的 JDK、SDK 和 NDK 路径被放入 Tools >选项>设备 >Android
区域,我已经完成了:
When looking into this, the only solution I can find is people saying to make sure my JDK, SDK, and NDK paths were put into the Tools > Options > Devices > Android
area, which I'd already done:
还没有真正找到其他可能导致问题的原因.任何关于从这里去哪里的想法都将不胜感激.
Haven't really been able to find what else could be causing the problem. Any ideas on where to go from here would be most appreciated.
推荐答案
是最新的Android SDK Tools (25.3.0)的问题
It is a problem with newest Android SDK Tools (25.3.0)
QT 5.8/QT Creator 4.2.1 使用旧的、现已从 Android 工具中删除的可执行文件.
QT 5.8/QT Creator 4.2.1 uses old, now removed, executables from Android Tools.
https://developer.android.com/studio/releases/sdk-tools.html SDK 工具,修订版 25.3.0(2017 年 3 月)
:
已删除过时/弃用的工具:
- 安卓
QT 5.8 不会自动与 Android SDK Tools 25.3.0 一起工作,要使其工作,您需要手动修改文件:
QT 5.8 will not work automatically with Android SDK Tools 25.3.0, and to make it work, you will need to modify files by hand:
QT无法区分Android目标版本,需要在
<project>.pro.user
文件中修改(编辑此文件时必须关闭QT)
QT is unable to distinguish Android target versions and those need to be modified in
<project>.pro.user
file (QT must be closed while editing this file)
同样由于未记录的更改,Android SDK 工具不再提供 templates
文件夹.QT 要求它们在那里构建,因此您需要将它们从 AndroidStudio 复制:pluginsandroidlibemplates
到 ;模板
Also from not documented changes, there is no longer templates
folder available from Android SDK Tools. QT require them to be there to build, so you will need to copy them from AndroidStudio: <path to AndroidStudio>pluginsandroidlibemplates
into <path to Android SDK>emplates
信息:通过 AndroidStudio 对 SDK 包进行的每次更新都会删除此文件夹,您需要再次复制它
最简单的解决方案是获取旧版本的 Android SDK 工具(并将它们仅用于 QT).我已经设法通过修改此站点 https://developer.android 的链接来做到这一点.com/studio/index.html#downloads 指向以前的版本:
easiest solution would be to get older version of Android SDK Tools (and use them only for QT). I've managed to do so by modifying link from this site https://developer.android.com/studio/index.html#downloads to point to previous version:
https://dl.google.com/android/repository/tools_r25.2.5-windows.zip
这篇关于QT Creator 不会列出任何可用的 Android Build SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!