Qt Android Application Execution failed - android

I'm learning developing Android Application by Qt Creator (v4.1.0 Community). When I build my sample app, there's no issue but when I run it with Android x86 Kit (GCC 4.9, Qt 5.7.0), it's failed and I get this message from Compile Output Console (it still runs well when I run with Desktop Qt 5.7.0 MinGW 32 bit):
'C++' is not recognized as an internal or external command, operable
program or batch file.
'C++\Qt\build-AndroidAppSample-Android_for_x86_GCC_4_9_Qt_5_7_0-Debug\android-build\'
is not recognized as an internal or external command, operable program
or batch file. Error: Could not find or load main class
org.gradle.wrapper.GradleWrapperMain Building the android package
failed!
-- For more information, run this command with --verbose.
21:04:35: The process "C:\Qt\5.7\android_x86\bin\androiddeployqt.exe"
exited with code 14. Error while building/deploying project
AndroidAppSample (kit: Android for x86 (GCC 4.9, Qt 5.7.0)) When
executing step "Build Android APK"
Can anybody explain me what I do wrong or give some ideas to solve it. Thanks for any help.

Do you see your Android kit get detected automatically ? or was it added by you manually. I would suggest to try the thing I mentioned below and see if that helps.
On Projects, Build Android APK, change the Android build SDK to newer version as shown in the picture below:

Related

Building QT Android app: ..i686-linux-android-g++: No such file or directory

I am building the first application in QT Creator, and came to the step I don't understand.
I have Mac, Android Studio is installed, Android SDK and NDK are installed using Studio. PATH to $ANDROID_NDK_ROOT is set manually.
My application compiles for Desktop without problems but trying to compile it for Android gives me this error:
/bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-g++: No such file or directory
/bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
/bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
Project ERROR: Cannot run target compiler '/Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++'. Output:
===================
/bin/sh: /Users/drob/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++: No such file or directory
===================
Maybe you forgot to setup the environment?
Error while parsing file /Users/drob/OneDrive/DEVEL/PROJECTS/QT_Projects/btchat/btchat.pro. Giving up.
I found that I should do the following steps, but I am scared to completely crash the system:
1. Install G++ (but what is this and how to install it on Mac properly)
2. Create G++ toolchain using NDK script (unfortunately too complicated for me. Some guide will be welcome)
What I also found out is that normally QT for Mac uses Clang compiler from XCode that I also have got installed. Should I somehow make QT Creator use that compiler instead of G++?
Sorry for questions that might sound silly but I am really lost at that point
Using the trial and error method I found that it is practically impossible to make NDK r10e work with QT 5.9. I ended up installing latest NDK and latest QT (5.12.6)

Compiling error of deploying app into android device using QT

I am developing an app using QT for android on Window Platform. And I encountered a problem when I clicked 'Build' button for the android project. The error message showed that "
Cannot run target compiler 'C:\Android\android-ndk-r16b-windows-x86_64\android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++'. Maybe you forgot to setup the environment?"
When I clicked 'Run' to the project, the error message showed that
"Cannot find the androiddeploy Json file.
Error while building/deploying project PhotoViewer (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.9.3 for Android armv7))
When executing step "Deploy to Android device"".
I checked the correctness of my compiler location and they are correct. I am not sure what I did wrong for the config setting.
Did you correctly installed and configured all prerequisites for Android QT development ?
regarding Cannot run target compiler 'C:\Android\android-ndk-r16b-windows-x86_64\android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++'
Check if Android NDK and the path in the error message does exist, QT is sure to work with ndk r10e.
if you are new to QT android development, you need to follow instructions here :
Installing the Prerequisites

QT and Android app building ends with "stdlib.h: No such file or directory"

Introduction
I'm trying to compile empty qt widget to android apk, just to test if my environment and configuration is correct. However it seems that for some reason compiler doesn't see some headers files.
Test Code (mainwindow.cpp)
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
It basically doesn't do anything, it's just compilation test.
My configuration
QT 5.8
OpenJDK 8.0.5120.1
Android SDK platform 27
Android NDK r16, 32bit and 64bit (tested both)
Windows 8.1 64 bit
QT Toolkits:
Android for armeabi-v7a (GCC 4.9, Qt 5.8.0)
Android for x86 (GCC 4.9,Qt 5.8.0)
The Question
Compilation of ever android apps, including this empty one mentioned above ends with:
stdlib.h: No such file or directory
Compiling desktop (*exe) apps works fine. I just can't configure correctly my environment for compilation android apk's. I tried with different versions of Android NDK, architecture, and with "QMAKE_CFLAGS_ISYSTEM=". Nothing works so far. What should I do to make it works?
UPDATE:
Thanks to #AlexCohn help I'm a bit closer to solve the issue. After changing NDK from r16 to r10e-x86 and SDK tools to 25.2.5, compilation goes a bit more, but not reach the end, as it brakes with the following command:
Building the android package failed!
-- For more information, run this command with --verbose.
Proces
"C:\Programming\Qt\5.8\android_armv7\bin\androiddeployqt.exe" exited
with code 14.
Error while building/deploying project and_test (kit:
Android for armeabi-v7a (GCC 4.9, Qt 5.8.0)) When executing step
"Build Android APK"
UPDATE 2:
Issue seems to be solved. One more change is needed as QT 5.9 seems to have compatibility issues with some versions of OpenJDK or Java SE. After a research I found that it is nesesery to install Java SE Development Kit 8. With this version, and all previous changes, finally the compilation ends successfully.

Tensorflow android example won't build

I'm trying to build the android example from tensorflow but keep running into an annoying build error. My steps so far:
installed android studio for the SDK. (v24)
downloaded android NDK 10e (other versions don't seem to work)
aditionally installed SDK build tools 23.0.1 (v24 doesn't seem to work)
added an assets folder to the android example with the inception model
edited the WORKSPACE file to point to the NDK/SDK locations.
I tried several versions of TF, but I keep getting the error. Any ideas?
The error:
C++ compilation of rule '#protobuf//:protobuf' failed: namespace-sandbox failed: error executing command /home/sander/.cache/bazel/_bazel_sander/577a8dcd97360f56540bc1f3f08ac240/tf-cat-face/_bin/namespace-sandbox ... (remaining 51 argument(s) skipped).
src/main/tools/namespace-sandbox.c:697: execvp(argv[0], argv): No such file or directory
Target //tensorflow/examples/android:tensorflow_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.
Bazel creates a sandbox for each compilation step, so your build doesn't include anything unintentional. However, last time I checked, TF can't use the sandbox because its build isn't completely hermetic. The errors you're getting are sandboxing errors (it can't find something that's supposed to be in the sandbox) so you can turn the sandbox off with --genrule_strategy=standalone and --spawn_strategy=standalone flags, e.g.,
bazel build --genrule_strategy=standalone --spawn_strategy=standalone //path/to/your:target
If you're looking for a quick way to build the TensorFlow Android demo app, check out this tutorial I wrote.
The articles explain more, but I created this Docker image which contains all the dependencies you need so that you can just pull the Docker image and build the Android demo app.
The one gotcha I found was that I needed to pass the --local_resources option to ensure that builds succeed inside Docker (otherwise they run out of memory, even on my 3.1 GHz, 16GB RAM Macbook Pro):
bazel build -c opt --local_resources 4096,4.0,1.0 -j 1 //tensorflow/examples/android:tensorflow_demo

Using Qt Creator for non-qt Android c++ development

I'm trying to setup Qt Creator for Android C++ development that uses non-Qt libraries. Testing with a simple Hello World, I have a problem in deploying the compiled program to AVD through Qt Creator. The deployment process always stuck with an error message of;
Install to device: emulator-5554 No platform plugin, neither
libqtforandroid.so or libqtforandroidGL.so, included in package.
Please include one. 06:34:06: The process
"/home/dev/Qt5.3.0/5.3/android_armv7/bin/androiddeployqt" exited with
code 12. Error while building/deploying project helloworld (kit:
Android for armeabi-v7a (GCC 4.8, Qt 5.3.0)) When executing step
'Deploy to Android device'
How should I go about it?
Thanks.

Categories

Resources