QT_ANDROID_EXTRA_LIBS

Bibliotecas adicionais a serem implantadas com o destino.

Essa propriedade foi introduzida no Qt 6.0.

Observação: essa propriedade é usada apenas se o destino for a plataforma Android.

Uma lista de bibliotecas externas que serão copiadas para a pasta ` libs ` do seu aplicativo e carregadas na inicialização. Isso pode ser usado, por exemplo, para habilitar o OpenSSL no seu aplicativo. Para mais informações, consulte Adicionando suporte ao OpenSSL para Android.

Ao adicionar bibliotecas extras da árvore de compilação do seu projeto, também é necessário definir relações de dependência entre a biblioteca e o destino do aplicativo. Utilizar a seguinte estrutura de projeto pode causar um problema ao implantar um apk:

qt_add_executable(MyApp main.cpp)

set_target_properties(MyApp PROPERTIES
    QT_ANDROID_EXTRA_LIBS
        ${CMAKE_CURRENT_BINARY_DIR}/libMyService_${ANDROID_ABI}.so
)

# MyService library doesn't have any relations with MyApp
qt_add_library(MyService service.cpp)

Isso gera incerteza quanto à disponibilidade da biblioteca `MyService` antes da implantação do `MyApp`. A solução mais simples é adicionar a biblioteca `MyService` às dependências do `MyApp`:

add_dependencies(MyApp MyService)

Ao adicionar bibliotecas específicas por arquitetura a um projeto multi-abi, liste todos os caminhos explicitamente, em vez de depender de variáveis como ` CMAKE_ANDROID_ARCH_ABI ` para calcular dinamicamente os caminhos.

Preferência:

set(libs
    ${CMAKE_CURRENT_BINARY_DIR}/libA_x86so
    ${CMAKE_CURRENT_BINARY_DIR}/libA_x86_64.so
    ${CMAKE_CURRENT_BINARY_DIR}/libA_arm64-v8a.so
    ${CMAKE_CURRENT_BINARY_DIR}/libA_armeabi-v7a.so
)
set_target_properties(MyApp PROPERTIES QT_ANDROID_EXTRA_LIBS ${libs})

# When targeting precompiled libs
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC libA_${ANDROID_ABI})

em vez de:

set_target_properties(MyApp PROPERTIES
    QT_ANDROID_EXTRA_LIBS
        ${CMAKE_CURRENT_BINARY_DIR}/libA_${CMAKE_ANDROID_ARCH_ABI}.so)

Veja também qt_android_generate_deployment_settings().

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