- Qt 5.2 + Android
- Qt C++ сборка под Android
- Android ndk root environment variable
- Android ndk root environment variable
- Android¶
- Using android-ndk package (build require)¶
- Use built-in Conan toolchain¶
- Using Docker images¶
- Using existing NDK¶
- Using toolchain from Android NDK¶
- Using CMake build-in Android NDK support¶
Qt 5.2 + Android
Доброго дня. Попытался поставить себе 5.2 и попробовать писать под андроид, но не могу скомпилировать приложение под андроидный симулятор. Видимо, что-то не так установил/настроил. Просьба посмотреть и подсказать, что я сделал не правильно или лишнего.
Скачал со страницы qt-project Qt Online Installer for Windows. Запустил, указал путь установки D:\Qt\5.2, выбрал компоненты по умолчанию, плюс MinGW 4.8.0.
Согласно Getting Started with Qt for Android скачал по приведенным ссылкам Android SDK, Android NDK, Ant, JDK. Первые три распаковал (создал для них в папке кьюта подпапку «for.android»), четвертый установил. Указал в настройках Qt Creator (в разделе андроида) пути к ним (насчет NDK он тут же выдает предупреждение: «Отсутствует профиль Qt для архитектуры mips. Для его добавления зайдите в Параметры — Сборка и запуск — Профили Qt», что за профиль — я не знаю).
Создаю AVD с дефолтными настройками (API — android-19, ABI — armeabi-v7a), 200МБ.
В переменных среды винды добавляю «Переменные среды пользователя»: «ANDROID_NDK_ROOT»-«D:\Qt\5.2\for.android\android-ndk-r9c» (при сборке Qt Creator ругается на ее отсутствие) и «JAVA_HOME»-«D:\Program Files\Java\jdk1.7.0_45\bin» (в Getting Started пишут, что нужно ее установить).
Создаю в Qt Creator новый проект «Приложение Qt Widgets» (с квиком пока не хочу разбираться), в комплектах выбираю «Android для armeabi-v7a (GCC 4.8, Qt 5.2.0) -Android GCC (arm-4.8)» (также есть вариант без -Android GCC, но у него компилятор не задан, а отладчик не найден) и «Desktop Qt 5.2.0 MinGW 32bit».
Запускаю HelloWorld-приложение под десктоп, все нормально.
Выбираю комплект Android (например, отладка), жму запуск. В результате:
«Проблемы»: [install_target] Error 1
«Консоль сборки»: (смущают русские буквы в пути)
Эмулятор запускается, но следов моего приложения в нем обнаружить не удалось.
То же, но проект Qt Quick
«Проблемы»:
Error 4
Источник
Qt C++ сборка под Android
Всем привет!
Написал с другом большой проект на QtC++ в QtCreator. Нужно запустить программу на смартфоне.
Установил и настроил Java, NKS, SDK.
В конфигурации проекта появилась возможность сборки под Android, но выдаёт ошибки.
Как исправить?
Спасибо за ответы!
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file F:/QtCreator/5.15.0/android/mkspecs/android-clang/qmake.conf.
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project ERROR: Unknown module(s) in QT: axcontainer
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project ERROR: Unknown module(s) in QT: axcontainer
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project ERROR: Unknown module(s) in QT: axcontainer
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project ERROR: Unknown module(s) in QT: axcontainer
Project WARNING: CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.
Project ERROR: Unknown module(s) in QT: axcontainer
сборка под android
Собственно, если у меня есть приложение, написанное с помощью qt creator, можно ли его как-нибудь.
Сборка под Android
Столкнулся с такой проблемой, что я не могу запустить свое приложение под Android, в Qt возникает.
Сборка Qt под Android
Собираю qt 5.1.1 под андроид. Все скачал и подключил: 1. sdk 2. ndk 3. ant 4. jdk 1.7 .
Сборка Qt Serial Port под Android из source
Добрый день помогите пожалуйтса собарть комплект Serial port под android, скачал сорцы, выставил.
Источник
Android ndk root environment variable
I have some trouble to cross compile a small Qt programm and load it into a Samsung Tab 4 device.
First of all this is my configuration:
Ubuntu 15.04
Processor Intel Core 2 Duo CPU T7500 @ 2.20GHz*2
OS type 32 bit
Qt 5.5.0
So I download all what I needed (ant, java, ndk and sdk).
I did all the configuration part inside Qt in tools/options following several tutorials
On Android configuration, it found 8 compilation toolchains and ticked the box to create them automatically
In Compile and Run, I found the 8 ones under the compiler tab.
I have created a kit manually (only the desktop one was auto detected) and getting this warning:
the compiler . cannot produce code for the Qt version Qt 5.5.0 32 bits
When I open a project I get this message:
/bin/sh: 1: /toolchains/x86-4.9/prebuilt/linux-x86/bin/i686-linux-android-gcc: not found
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/damien/Qt5.5.0/5.5/gcc/mkspecs/android-g++/qmake.conf.
So far what I have done that trying to solve the problem:
1°) on bashrc I added the following export path:
export ANDROID_HOME=/home/damien/android-sdk-linux
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ANDROID_HOME=/home/damien/android-ndk-r10e
export ANDROID_SDK_ROOT=/home/damien/android-sdk-linux
export ANDROID_NDK_ROOT=/home/damien/android-ndk-r10e
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:$ANDROID_NDK
2°) I gave all the rights to NDK by using chmod 777
I still have the same problem and I passed at least 2 days to find on Internet what’s going on.
Does anyone have a shrink idea how to solve this problem?
Thanks in advance,
Damien
@Garfield Hi, I documented this error some time ago while using Qt for Android and it looks like setting ANDROID_NDK_ROOT was enough.
I checked again my dev environment, and the only variables set are:
ANDROID_NDK_ROOT=C:\devtools\android-ndk-r9c
.
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
.
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Ja
va\jdk1.7.0_25\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Java\jdk1.7
.0_25\jre\bin\server;C:\Python27\Lib\site-packages\PyQt4;C:\Python27;C:\Python2
7\Scripts;C:\Perl\site\bin;C:\Perl\bin;C:\devtools\android-sdk-windows\platform-
tools;C:\Users\pablo\AppData\Roaming\Python\Scripts;C:\Ruby200\bin
@Pablo-J.-Rogina Hello Thanks for your quick reply;
Actually, I added so many paths on bashrc to be sure to resolve the problem.
It didn’t work even by just adding one.
Do you have any others idea?
Well, I’ll start from scratch. I first install Android SDK, Android NDK, Ant and Java and set the required environment variables, as few as possible. Then I’ll install Qt so Qt Creator will find (hopefully) everything automatically and you ‘ll have the kits set in Qt Creator with the proper values. Just my two cents.
@Pablo-J.-Rogina
So you think that installing SDK and NDK before Qt creator has an impact?
What should I do then? uninstall Qt and install it again?
I guess that having the Android components in place before installing Qt may help you.
Yes, uninstall Qt and install it only after you have installed all required components (Android SDJ, NDK, Ant and Java) and setting the required environment variables.
Ok I will do that exactly now. thanks in advance
So I uninstalled Qt and removed all the files in the folder.
Nevertheless, when I reinstall it, I still get the same results and Qt creator kept also the old config. i.e the manual kit I’ve created
Hi and welcome to devnet,
IIRC, the Android SDK/NDK doesn’t install the x86 compilers by default, you have to add them yourself using their management tool
Hi thanks for your reply,
I guess I have installed all the compilers availaible using SDK manager.
8 toolchains were found by Qt.
I reinstalled everything from scratch (ubuntu, sdk, ndk, qt etc. ) and it did not solve the problem.
I know that my problem must be a stupid thing but I just don»t get it and it frustrates me a lot.
do you have any other idea how to proceed?
Thanks in advance,
damien
By the way, I found that the Intel Core 2 Duo CPU T7500 is a 64 bits one.
I have installed Ubuntu 32 bits because there was no added value for me to install a 64 bits one.
for some compatibility reasons I kept also a 32 bits one when I started to use Ubuntu 4 years ago
Do you think that it could potential be the source of the problem or it doesn’t matter?
Источник
Android ndk root environment variable
Hello! I am trying to install the mqtt module to android_armv7. To do this, I create a folder named build and run this:
/Qt/5.12.4/android_armv7/bin/qmake qmake -r .. . Unfortunately I recieve this error:
I have tried going to tools->External->Configure->Environment->External Tools->Update Translations and wrote:
ANDROID_NDK_ROOT=/home/stefan/Downloads/android-ndk-r19c/android-ndk-r19c
PATH=
in the Environment Change section. It didn’t work. A strange thing (for me) is that I can deploy an application (without mqtt) on android_armv7. I am using Linux. What should I do now?
It looks like you are trying to do that in a terminal and modify settings in an application. What exactly are you doing ?
Since you have it working in Qt Creator as it seems, just define these environment variable for the terminal you want to build qtmqtt in.
If you want to install mqtt module, you have to install it inside lib of android, and they will make for all architecture.
You can refer this link to install it.
https://forum.qt.io/topic/107020/how-to-use-mqtt-client-class-in-qml/9
It looks like you are trying to do that in a terminal and modify settings in an application. What exactly are you doing ?
Since you have it working in Qt Creator as it seems, just define these environment variable for the terminal you want to build qtmqtt in.
Hi and thank you for the reply. It works in the Qt Creator, but only for gcc_64. How should I define the environment variables?
How should I define the environment variables?
In the same way they are set in Build Environment in QtCreator: «Projects/Build & Run/Build/Build Environment».
@jsulm Thank you! But the ANDROID_NDK_ROOT variable points my Android NDK.
Источник
Android¶
There are several ways to cross-compile packages for Android platform via conan.
Using android-ndk package (build require)¶
The easiest way so far is to use android-ndk conan package (which is in conancenter repository).
Using the android-ndk package as a build requirement will do the following steps:
- Download the appropriate Android NDK archive.
- Set up required environment variables, such as CC , CXX , RANLIB and so on to the appropriate tools from the NDK.
- In case of using CMake, it will inject the appropriate toolchain file and set up the necessary CMake variables.
For instance, in order to cross-compile for ARMv8 , the following conan profile might be used:
In addition to the above, Windows users may need to specify CONAN_MAKE_PROGRAM , for instance from the existing MinGW installation (e.g. C:\MinGW\bin\mingw32-make.exe ), or use make from the mingw_installer/1.0@conan/stable .
Similar profile might be used to cross-compile for ARMv7 (notice the arch change):
By adjusting arch setting, you may cross-compile for x86 and x86_64 Android as well (e.g. if you need to run code in a simulator).
os.api_level is an important setting which affects compatibility — it defines the minimum Android version supported. In other words, it is the same meaning as minSdkVersion.
Use built-in Conan toolchain¶
This is an experimental feature subject to breaking changes in future releases.
Conan will generate a toolchain for Android if the recipe is using a CMakeToolchain . In that case all you need is to provide the path to the Android NDK and working profiles . This approach can also use the Android NDK package referenced in the previous section.
Use a regular profile for the host context:
and add Android NDK to the PATH or populate the CONAN_CMAKE_ANDROID_NDK environment variable.
Together with the files created by the generators that make it possible to find and link the requirements, conan install command will generate a toolchain file like the following one:
With this toolchain file you can execute CMake’s command to generate the binaries:
Using Docker images¶
If you’re using Docker for builds, you may consider using docker images from the Conan Docker Tools repository.
Currently, Conan Docker Tools provide the following Android images:
- conanio/android-clang8
- conanio/android-clang8-x86
- conanio/android-clang8-armv7
- conanio/android-clang8-armv8
All above mentioned images have corresponding Android NDK installed, with required environment variables set and with default conan profile configured for android cross-building. Therefore, these images might be especially useful for CI systems.
Using existing NDK¶
It’s also possible to use an existing Android NDK installation with conan. For instance, if you’re using Android Studio IDE, you may already have an NDK at
You have to specify different environment variables in the Conan profile for make-based projects. For instance:
However, when building CMake projects, there are several approaches available, and it’s not always clear which one to follow.
Using toolchain from Android NDK¶
This is the official way recommended by Android developers.
For this, you will need a small CMake toolchain file:
This toolchain file only sets up the required CMake variables, and then includes the default toolchain file supplied with Android NDK.
And then, you may use the following profile:
In the profile, CONAN_CMAKE_TOOLCHAIN_FILE points to the CMake toolchain file listed above.
Using CMake build-in Android NDK support¶
This workflow is not supported by Android and is often broken with new NDK releases or when using older versions of CMake. This workflow is strongly discouraged and will not work with Gradle.
For this approach, you don’t need to specify CMake toolchain file at all. It’s enough to indicate os is Android and Conan will automatically set up all required CMake variables for you.
Therefore, the following conan profile could be used for ARMv8 :
The only way you have to configure is ANDROID_NDK_ROOT which is a path to the Android NDK installation.
Once profile is configured, you should see the following output during the CMake build:
It means native CMake integration has successfully found Android NDK and configured the build.
© Copyright 2016-2021, JFrog. Last updated on Dec 03, 2021. Cookies Settings
Источник