在 Qt 中构建 Android 项目不再起作用 [英] Building Android projects in Qt doesn't work anymore
问题描述
所以我对 Android SDK、NDK 和 Apache Ant 进行了一些更新,但现在我无法构建任何 Android 项目...
我收到一个警告,然后它说找不到 build.xml 文件.错误:
警告:Android 平台android--1"在 SDK 中不存在.生成 Android 包输入文件:/home/mirza/Development/Qt Projects/build-Test-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_7_1-Debug/android-libTest.so-deployment-settings.json输出目录:/home/mirza/Development/Qt Projects/build-Test-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_7_1-Debug/android-build/应用程序二进制文件:/home/mirza/Development/Qt Projects/build-Test-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_7_1-Debug/libTest.soAndroid构建平台:android--1安装到设备:否构建文件:build.xml 不存在!构建失败构建android包失败!-- 有关更多信息,请使用 --verbose 运行此命令.
我已经安装了 lvl 15 以上的 SDK,SDK 上的 NDK 14 和 Apache Ant 1.10.1.好吧,它仍然说我的 SDK 中没有 API 1,它甚至无法在我的 SDK 管理器中作为官方下载提供,并且 build.xml 也丢失了.是否会出现丢失文件的 bcs 警告?而且我也不愿意在菜单 Projects -> Build Android-APK -> Android-Build-SDK 中选择 API lvl,这样做之后什么也没有显示.我什至重新安装了我的整个系统并下载了所有 itams,bcs 我认为这是某种配置错误,但似乎我这里有一些不兼容的版本.
我按照以下 2 个建议修复了这个错误:
<块引用>
Android SDK 工具不再提供 templates
文件夹.QT 要求它们在那里进行构建,因此您需要从 AndroidStudio 复制它们:\
进入
经过这些修改后,QtCreator 可以正确识别 Project->(Android)Build Settings
(P.S. 我链接的另一个 SO 答案也解释了第 1 点问题,但我提供的站点更具说明性,并链接了所有操作系统版本).
So I made some updates to the Android SDK, NDK and Apache Ant and now I am not able to build any Android projects...
I get one warning and then it says it can't find the build.xml file. The error:
Warning: Android platform 'android--1' does not exist in SDK.
Generating Android Package
Input file: /home/mirza/Development/Qt Projects/build-Test-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_7_1-Debug/android-libTest.so-deployment-settings.json
Output directory: /home/mirza/Development/Qt Projects/build-Test-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_7_1-Debug/android-build/
Application binary: /home/mirza/Development/Qt Projects/build-Test-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_7_1-Debug/libTest.so
Android build platform: android--1
Install to device: No
Buildfile: build.xml does not exist!
Build failed
Building the android package failed!
-- For more information, run this command with --verbose.
I have installed the SDKs from lvl 15 upwards, NDK 14 over SDK and Apache Ant 1.10.1. Well, it still says that I dont have the API 1 in my SDK, which isn't even available as official download in my SDK manager and the build.xml is also missing. Could it be that warning is comming up bcs of the missing file? And I am also not bale to choose the API lvl in menu Projects -> Build Android-APK -> Android-Build-SDK, nothing shows up after doing that. I have even installed my whole system again and downloaded all iteams, bcs I thought it's some kind of configuration error, but seems like I have some incompatible versions here.
I fixed this error by following these 2 suggestion:
As explained here here, the latest Android SDK tools supported by Qt 4.2 are the "r25.2.5". So download them and subtitute the current
tools
folder with it.As suggested by V-master, in the second part of this other answer:
there is no longer a
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>\plugins\android\lib\templates
into<path to Android SDK>\templates
After these modifications QtCreator was correctly recognizing the Build SDK in the dropdow list in Project->(Android)Build Settings
(P.S. The other SO answer I linked also explains the point 1 problem, but the site I provided is way more explicative and links all OSes versions).
这篇关于在 Qt 中构建 Android 项目不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!