A ferramenta androiddeployqt
A compilação de um pacote para Android envolve várias etapas; por isso, o Qt vem com uma ferramenta que realiza esse trabalho para você. As etapas realizadas pela ferramenta Android Deploy Qt estão descritas em “Implantando um aplicativo no Android”.
Pré-requisitos antes de executar o androiddeployqt
Antes de executar a ferramenta manualmente, você precisa configurar seu projeto com o ` CMake ` ou o ` qmake ` para gerar o ` Makefiles ` e um arquivo ` JSON ` (por exemplo, ` android-<target_name>-deployment-settings.json`) contendo configurações importantes utilizadas pelo ` androiddeployqt`.
Observação: Nãoé recomendado modificar o arquivo JSON androiddeployqt.
Para preparar o ambiente para o androiddeployqt, configure seu projeto em um diretório diferente do diretório de código-fonte. Para obter mais informações sobre como configurar seu projeto, consulte Compilando projetos Qt para Android a partir da linha de comando.
Argumentos da linha de comando
Os únicos argumentos de linha de comando obrigatórios ao executar a ferramenta são ` --input ` e ` --output`. Outros argumentos de linha de comando são opcionais, mas úteis. A lista abaixo fica disponível ao passar o argumento ` --help ` para o `androiddeployqt`.
Syntax: androiddeployqt --output <destination> [options]
Creates an Android package in the build directory <destination> and
builds it into an .apk file.
Optional arguments:
--input <inputfile>: Reads <inputfile> for options generated by
qmake. A default file name based on the current working
directory will be used if nothing else is specified.
--deployment <mechanism>: Supported deployment mechanisms:
bundled (default): Includes Qt files in stand-alone package.
unbundled: Assumes native libraries are present on the device
and does not include them in the APK.
--aab: Build an Android App Bundle.
--no-build: Do not build the package, it is useful to just install
a package previously built.
--install: Installs apk to device/emulator. By default this step is
not taken. If the application has previously been installed on
the device, it will be uninstalled first.
--reinstall: Installs apk to device/emulator. By default this step
is not taken. If the application has previously been installed on
the device, it will be overwritten, but its data will be left
intact.
--device [device ID]: Use specified device for deployment. Default
is the device selected by default by adb.
--android-platform <platform>: Builds against the given android
platform. By default, the highest available version will be
used.
--release: Builds a package ready for release. By default, the
package will be signed with a debug key.
--sign <url/to/keystore> <alias>: Signs the package with the
specified keystore, alias and store password.
Optional arguments for use with signing:
--storepass <password>: Keystore password.
--storetype <type>: Keystore type.
--keypass <password>: Password for private key (if different
from keystore password.)
--sigfile <file>: Name of .SF/.DSA file.
--digestalg <name>: Name of digest algorithm. Default is
"SHA-256".
--sigalg <name>: Name of signature algorithm. Default is
"SHA256withRSA".
--tsa <url>: Location of the Time Stamping Authority.
--tsacert <alias>: Public key certificate for TSA.
--internalsf: Include the .SF file inside the signature block.
--sectionsonly: Do not compute hash of entire manifest.
--protected: Keystore has protected authentication path.
--jarsigner: Deprecated, ignored.
NOTE: To conceal the keystore information, the environment variables
QT_ANDROID_KEYSTORE_PATH, and QT_ANDROID_KEYSTORE_ALIAS are used to
set the values keysotore and alias respectively.
Also the environment variables QT_ANDROID_KEYSTORE_STORE_PASS,
and QT_ANDROID_KEYSTORE_KEY_PASS are used to set the store and key
passwords respectively. This option needs only the --sign parameter.
--jdk <path/to/jdk>: Used to find the jarsigner tool when used
in combination with the --release argument. By default,
an attempt is made to detect the tool using the JAVA_HOME and
PATH environment variables, in that order.
--qml-import-paths: Specify additional search paths for QML
imports.
--verbose: Prints out information during processing.
--no-generated-assets-cache: Do not pregenerate the entry list for
the assets file engine.
--aux-mode: Operate in auxiliary mode. This will only copy the
dependencies into the build directory and update the XML templates.
The project will not be built or installed.
--apk <path/where/to/copy/the/apk>: Path where to copy the built apk.
--build-aar: Build an AAR package. This option skips --aab, --install,
--reinstall, and --sign options if they are provided.
--qml-importscanner-binary <path/to/qmlimportscanner>: Override the
default qmlimportscanner binary path. By default the
qmlimportscanner binary is located using the Qt directory
specified in the input file.
--depfile <path/to/depfile>: Output a dependency file.
--builddir <path/to/build/directory>: build directory. Necessary when
generating a depfile because ninja requires relative paths.
--no-rcc-bundle-cleanup: skip cleaning rcc bundle directory after
running androiddeployqt. This option simplifies debugging of
the resource bundle content, but it should not be used when deploying
a project, since it litters the "assets" directory.
--copy-dependencies-only: resolve application dependencies and stop
deploying process after all libraries and resources that the
application depends on have been copied.
--help: Displays this information.Com ` project_name`, para compilar o pacote do aplicativo com ` androiddeployqt ` sem implantá-lo no dispositivo, execute o seguinte:
androiddeployqt --input <build_dir>/android-project_name-deployment-settings.json \
--output <build_dir>/android-buildPara compilar e implantar o pacote no dispositivo:
androiddeployqt --input <build_dir>/android-project_name-deployment-settings.json \
--output <build_dir>/android-build --install --device <device_serial_id>Detecção de dependências
O Qt vem com vários plug-ins que são carregados em tempo de execução quando necessários. Eles podem lidar com tudo, desde a conexão com bancos de dados SQL até o carregamento de formatos específicos de imagem. Detectar dependências de plug-ins é impossível, pois eles são carregados em tempo de execução, mas o androiddeployqt tenta adivinhar essas dependências com base nas dependências do Qt da sua aplicação. Se o plug-in tiver alguma dependência do Qt que não seja também uma dependência da sua aplicação, ele não será incluído por padrão. Por exemplo, para garantir que o plug-in do formato de imagem SVG seja incluído, você precisará adicionar Qt SVG módulo ao seu projeto para que ele se torne uma dependência do seu aplicativo:
find_package(Qt6 REQUIRED COMPONENTS Svg)
...
target_link_libraries(target_name PRIVATE Qt6::Svg)Se você estiver se perguntando por que um determinado plug-in não é incluído automaticamente, pode executar o androiddeployqt com a opção “ --verbose ” para obter a lista de dependências ausentes para cada plug-in excluído. Você pode fazer o mesmo no “ Qt Creator ” marcando a caixa de seleção “ Verbose output ” em “ Projects ” > “ Build Steps ” > “ Build Android APK ” > “ Advanced Actions ”.
Também é possível especificar manualmente as dependências do seu aplicativo. Para obter mais informações, consulte a variável CMake QT_ANDROID_DEPLOYMENT_DEPENDENCIES.
Observação: o androiddeployqt verifica os arquivos QML do projeto para coletar as importações QML. No entanto, se você estiver carregando código QML como um ` QString ` a partir de C++ em tempo de execução, isso pode não funcionar corretamente, pois o androiddeployqt não terá conhecimento disso no momento da implantação. Para resolver isso, você pode adicionar um arquivo QML fictício que importe esses módulos QML referenciados em tempo de execução.
Implantação em Qt Creator
Qt Creator usa o ` androiddeployqt ` nos bastidores e oferece interfaces de usuário fáceis e intuitivas para especificar várias opções. Para obter mais informações, consulte Qt Creator: Configuração de implantação do Android.
Para obter mais informações sobre como personalizar e implantar um aplicativo Qt para Android, consulte “Implantação de um aplicativo no Android”.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.