Mark
Mark

Reputation: 51

Selecting Android API level in Qt QMake

I'm using Qt 'qmake' from the command line (no use of QtCreator) am building for an Android target. No matter what I do it seems to use Android API level 9 in the Makefile it generates. Is there a command-line option, environment variable, or other method I can use to tell qmake to use a specific Android API level. I've been searching for a long time and cannot find anything.

Upvotes: 2

Views: 5452

Answers (2)

Sathya
Sathya

Reputation: 195

Change environment to ANDROID_NDK_PLATFORM=android- the api-level you want or in QtCreator->Project->Build Environment->Add/update the above variable.

Upvotes: 2

Alastair Harrison
Alastair Harrison

Reputation: 1361

To choose a specific minimum API level, you need to provide your own Android manifest file.

I know you're not using Qt Creator, but it supports this by being able to generate a new manifest file from a template.

More details available from the Qt Docs on deploying to Android: http://doc.qt.io/qtcreator/creator-deploying-android.html

You can specify settings for the androiddeployqt tool in Qt Creator and in the project .pro file. To specify settings in Qt Creator, select Projects > Build Android APK > Details.

...

You can use the qmake variables to specify all the settings you need for the androiddeployqt tool and you do not need an Android manifest file until you want to publish the package in an application store. To specify additional settings for APK packages, you can create an Android manifest file and edit it in Qt Creator. Select Create Templates to create the file and to open it in the Android Manifest Editor.

If you're not using Qt Creator you'll presumably need to generate an Android manifest file manually and place it in your source directory. androiddeployqt should pick it up.

ANDROID_PACKAGE_SOURCE_DIR: This variable can be used to specify a directory where additions and modifications can be made to the default Android package template. The androiddeployqt tool will copy the application template from Qt into the build directory, and then it will copy the contents of the ANDROID_PACKAGE_SOURCE_DIR on top of this, overwriting any existing files.

...

If you, for instance, want to make a custom AndroidManifest.xml for your application, then place this directly into the folder specified in this variable.

...

Note: When adding custom versions of the build files (like strings.xml, libs.xml, AndroidManifest.xml, etc.) to your project, make sure you copy them from the package template, which is located in $QT/src/android/java. You should never copy any files from the build directory, as these files have been altered to match the current build settings.

Upvotes: 1

Related Questions