在Qt中构建Android项目不再起作用 [英] Building Android projects in Qt doesn't work anymore

查看:219
本文介绍了在Qt中构建Android项目不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我对Android SDK,NDK和Apache Ant进行了一些更新,现在我无法构建任何Android项目...

So I made some updates to the Android SDK, NDK and Apache Ant and now I am not able to build any Android projects...

我得到一个警告,然后它说找不到build.xml文件. 错误:

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.

我从lvl 15起安装了SDK,在SDK和Apache Ant 1.10.1上安装了NDK 14.嗯,它仍然说我的SDK中没有API 1,甚至在我的SDK管理器中也没有作为正式下载提供的API,而且还缺少build.xml.可能是警告提示正在丢失文件的bcs吗?而且我也不敢在菜单 Projects-> Build Android-APK-> Android-Build-SDK 中选择API lvl,这样做之后没有任何显示.我什至再次安装了整个系统并下载了所有iteam,bcs我认为这是某种配置错误,但似乎这里有一些不兼容的版本.

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.

推荐答案

我通过以下2条建议解决了该错误:

I fixed this error by following these 2 suggestion:

  1. 如此处此处所述, Qt 4.2支持的最新Android SDK工具为"r25.2.5".因此,请下载它们并用它替换当前的tools文件夹.

  1. 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.

根据V-master的建议,在

As suggested by V-master, in the second part of this other answer:

Android SDK Tools不再提供templates文件夹. QT要求它们在那里进行构建,因此您需要从AndroidStudio复制它们: \<path to AndroidStudio>\plugins\android\lib\templates 进入 <path to Android SDK>\templates

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

进行这些修改后,QtCreator可以正确识别Project->(Android)Build Settings

After these modifications QtCreator was correctly recognizing the Build SDK in the dropdow list in Project->(Android)Build Settings

(P.S.我链接的另一个SO答案也解释了第1点的问题,但是我提供的站点更具解释性,并且链接了所有OS版本).

(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆