What's the problem? android compile error
-
Ok, finally got mine to work. What a %@$# PITA... I really dislike windows, but it's where I chosen do android dev unfortunately.
So... here's what I did... (it may have just been one of these that fixed the issue, but I'm too tired to go back and test them individually)
1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of \)... AND add some. Specifically:
ANDROID_HOME = D:\Android-SDK ANDROID_SDK_ROOT = D:\Android-SDK GRADLE_USER_HOME = C:\Users\pc\.gradle JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
(obviously these need to be upd for your install directories .i.e usually on C: drive)
Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.
2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply.
Select 'show package details' to then be able to select the 28.0.3 version. Apply.3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:
androidBuildToolsVersion=28.0.3
Finally: you should probably should close and reopen QT and the project.
Build/deploy should now (hopefully/finally) work! -
Hi Jay_M,
Thanks for the solution! Now I can take the jump to Qt5.12.3 with my Android project
I tested your workarounds and the only thing you have to do is step 3:
3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to: androidBuildToolsVersion=28.0.3
I tested on some test applications and also on a real world application
You saved me a lot of time! Now you can save some time for your other projects with less tweaking ;-)Eddy
-
I have a similar problem. I followed the instructions of the tutorial for android and opened the analog clock example to build, deploy and start the app in the Android emulator.
I use Qt Creator for macOS with the newest suggested Qt versuin. I get following build errors:
/Users/burks/Library/Android/android-ndk-r20/toolchains/x86-4.9/prebuilt/darwin-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lc++ clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libshadereffects.so] Error 1
Some ideas, how to make a Qt app for Android running?
-
Hi,
I have exactly the same issue. Google Play Console requires adaptation for android-28 and arm64-v8a
from August 19, so QT developers cannot use r16b anymore and I have used NDK r20 instead. Unfortunatelly I received -lc++ library linking problem. I am not sure why, because the library is available in the expected path, and objdump returns correct armv7 architecture.To solve the issue with linking I just used android-ndk-19c version. But note, that the 19c contains some bug with support of spaces in the QRC paths, so for example I had to remove this from the QRC:
make[1]: *** No rule to make target '/project/fonts/customfont/pobrano z /project/fonts/customfont/koikj.txt', needed by 'qrc_qml.cpp'. Stop
-
The error: cannot find -lc++ using ndk r20 can be solved like this:
https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34For example to compile for android armv7 ndk r20, locate the file:
C:\Qt\5.13.0\android_armv7\mkspecs\android-clang\qmake.conf
and add the missing-nostdlib++
for android x86 (i use this for emulator), locate the file:
C:\Qt\5.13.0\android_x86\mkspecs\android-clang\qmake.conf
For error:
Execution failed for task ':compileDebugAidl'
locate the file on your build directory, mine is:C:\dev_qt\experiments\build-test_qt_5_13_0_ARMv7-Release\android-build\gradle.properties
and changeandroidBuildToolsVersion
from:androidBuildToolsVersion=29.0.0
to:androidBuildToolsVersion=28.0.3
-
@Albertino Thank your very much. Now I can build and run the calculator example project with the emulator. That's very motivating. However I get many warnings in the log. Maybe the example projects are not optimized for Android. I will check the tutorial a hallo world project.
I zygote : Not late-enabling -Xcheck:jni (already on) W zygote : Unexpected CPU variant for X86 using defaults: x86 W System : ClassLoader referenced unknown path: I QtCore : Start W linker : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x80 W linker : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Widgets.so" has unsupported flags DT_FLAGS_1=0x80 W linker : "/data/data/org.qtproject.example.calculator/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" has unsupported flags DT_FLAGS_1=0x80 I Qt : qt started D OpenGLRenderer: HWUI GL Pipeline I zygote : Background concurrent copying GC freed 14726(1133KB) AllocSpace objects, 18(380KB) LOS objects, 52% free, 1407KB/2MB, paused 741us total 254.773ms I zygote : Do partial code cache collection, code=26KB, data=30KB I zygote : After code cache collection, code=25KB, data=30KB I zygote : Increasing code cache capacity to 128KB I zygote : Background concurrent copying GC freed 14025(1072KB) AllocSpace objects, 20(512KB) LOS objects, 50% free, 1491KB/2MB, paused 53.091ms total 112.459ms I zygote : Do partial code cache collection, code=50KB, data=56KB I zygote : After code cache collection, code=48KB, data=55KB I zygote : Increasing code cache capacity to 256KB D : HostConnection::get() New Host Connection established 0x9a107280, tid 5700 I zygote : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 I OpenGLRenderer: Initialized EGL, version 1.4 D OpenGLRenderer: Swap behavior 1 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... D OpenGLRenderer: Swap behavior 0
-
This post is deleted!
-
@ali-aydin said in What's the problem? android compile error:
where is " theQT project/app's folder
It's you project folder where the source code is.