Building Android projects in Qt doesn't work a

2019-04-11 20:45发布

问题:

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.

回答1:

I fixed this error by following these 2 suggestion:

  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.

  2. 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).



标签: android qt ant