Set up Android development environment | Qt Creator Documentation

- Qt Creator Documentation
- Set up Android development environment
- Qt Creator 15.0.0

How To

# Set up Android development environment

Qt Creator offers to automatically install all the necessary packages and tools and to set up your Qt for Android development environment by creating debuggers, toolchains, and kits.

Use Qt Creator to:

- Download and extract the Android SDK Command-line Tools.
- Install or update the essential packages such as NDKs, build tools, and platform tools.

To set up the development environment for Android:

1. Go to Preferences > Devices > Android.

2. In JDK location, set the path to the JDK. Qt Creator checks the JDK installation and reports errors.

   By default, Qt Creator tries to find a supported Adoptium OpenJDK or OpenJDK installation. If it cannot find one, you must set the path manually. If you have not installed a supported JDK, select to open the JDK download web page in the default browser.

   Note: Use a 64-bit JDK because the 32-bit one might cause issues with `cmdline-tools`, and some packages might not appear in the list.

3. In Android SDK location, set the path to the folder to install the Android SDK Command-line Tools.
4. Select Set Up SDK to automatically download and extract the Android SDK Command-line Tools to the selected path.

   SDK Manager checks that you have the necessary tools. If you need more packages or updates, SDK Manager offers to add or remove the appropriate packages. Before taking action, it prompts you to accept the changes. In addition, it prompts you to accept Google licenses, as necessary.

5. Android NDK list lists the installed NDK versions. SDK Manager installed the locked items. You can modify them only from the Android SDK Manager dialog. For more information, see Manage Android NDK Packages.
6. Select Automatically create kits for Android tool chains to automatically create the necessary kits. Qt Creator displays a warning if it cannot find a suitable Qt version.
7. Optionally, in Android OpenSSL Settings group, set the path to the prebuilt OpenSSL libraries.

   For Qt applications that require OpenSSL support, add Android OpenSSL support to your project, as instructed in Adding External Libraries.

8. Select Download OpenSSL to download the OpenSSL repository to the selected path. If the automatic download fails, the download web page opens for manual download.

## Manual setup

If the automatic setup does not meet your needs, download and install Android SDK Command-line Tools, and then install or update the necessary NDKs, tools, and packages. For more information, see Getting Started with Qt for Android.

## View Android toolchain settings

A JSON configuration file defines the Android SDK Command-Line Tools download URL, the essential packages list, and the appropriate NDK for each Qt version. The file is in the Qt Creator resource folder:

     # Linux and macOS
     ~/.config/QtProject/qtcreator/android/sdk_definitions.json

     # Windows
     C:\Users\Username\AppData\Local\QtProject\qtcreator\android\sdk_definitions.json

For example, the SDK configuration file sets the NDK version 22.1.7171670 for use with Qt 6.3, Qt 6.2, and Qt 5.15.9 to 5.15.20:

     "specific_qt_versions": [
     {       "versions": ["6.3", "6.2", "5.15.[9-20]"],
             "sdk_essential_packages": ["build-tools;31.0.0", "ndk;22.1.7171670"]
         },
     ]

You can view the latest version of the configuration file that is up-to-date with the Android SDK and NDK changes, sdk_definitions.json, in Git.

Note: For Qt 6.5 or later, Qt Creator reads the NDK version that was used for building Qt from `modules/Core.json` and uses it instead of the version in `sdk_definitions.json`.

See also How To: Develop for Android, Developing for Android, and Kits.

How To