Solved QtLocation and QtPositioning modules are not installed...
-
I successfully build application with QML Map for Android. Deploy and run it on Android 7.1 device. The map does not appear. In console I see following:
: qrc:/map.qml:4:1: module "QtLocation" is not installed
: qrc:/map.qml:3:1: module "QtPositioning" is not installed
: qrc:/map.qml:4:1: module "QtLocation" is not installed
: qrc:/map.qml:3:1: module "QtPositioning" is not installedIn the map.qml at beginning I wrote:
import QtPositioning 5.8
import QtLocation 5.11Versions are latest suggested by QtCreator. Project contains QT += location positioning. Finally this application uses positioning in C++ code and it works fine. What is wrong?
PS: I have created bug report QTBUG-79596.
-
- which Qt version are you using?
- have you tried doing a clean rebuild? (clean, run qmake, rebuild)
- does it work on your desktop?
-
- 5.12.5
- yes
- not yet tried
-
@Gourmet have you added the requieret permissions in your manifest file and requested them (during runtime)
-
@Gourmet said in QtLocation and QtPositioning modules are not installed...:
- 5.12.5
- yes
- not yet tried
OK, please try on desktop first. If it works, then it's something about Android. If it does not work, then the issue is with your code or installation (or a bug in Qt).
-
@sierdzio this is not about Android definitely. Those modules must be provided with Qt but they are not.
PS: In my Kubuntu 18.04 LTS this error does not appear. Map works (I had small error in QML structure but fixed it). That means QML location and positioning modules for Kubuntu exist.
-
I found that two shared Qt libraries are not copied to app building directory. They exist in Qt distribution structure:
~/Qt5/5.12.5/5.12.5/android_armv7/qml/QtLocation/libdeclarative_location.so
~/Qt5/5.12.5/5.12.5/android_armv7/qml/QtPositioning/libdeclarative_positioning.soThey must be copied to
<build-dir>/android-build/libs/armeabi-v7a/libqml_QtLocation_libdeclarative_location.so
<build-dir>/android-build/libs/armeabi-v7a/libqml_QtPositioning_libdeclarative_positioning.sowhile building APK. But they are not. The bug is somewhere in Qt configuration files.
-
Try with Qt 5.13.1 and if it's not fixed there, please fill in a bug report.
-
@Gourmet
you said, this is your own app,can you try one of the examples that come with QtCreator and test if it's the same issue for those ?
https://doc-snapshots.qt.io/qt5-5.13/qtlocation-examples.html
-
@J-Hilk said in QtLocation and QtPositioning modules are not installed...:
@Gourmet
you said, this is your own app,can you try one of the examples that come with QtCreator and test if it's the same issue for those ?
https://doc-snapshots.qt.io/qt5-5.13/qtlocation-examples.html
The Map Viewer on Android tells "The active map type requires (missing) SSL". The map is gray, no tiles. But both files missing in my project - here in building example directory exist. I see difference in project files - the undocumented option QT_FOR_CONFIG += location-private with comment # Workaround for QTBUG-38735. Let's try add it to my project...
-
Nope... did not help.
-
You need to add OpenSSL.
-
@sierdzio probably then Map Viewer will work. To console it does not tell anything about non-installed modules - as I said in my first message. And module copies are in it's building directory. Now I have find why they do not copy in my project. I have all QT += options as required:
QT += core gui svg quick quickwidgets qml network positioning location sensors
-
I suppose the problem appears cause I use both QML location/positioning and C++ Qt-functions in one app. On the QT += location switch it copies C++ library - without it I cannot assemble project. But then it forgets about QML library.
-
The solution found.
Qt for Android has bug. To find which QML library must be included into APK it scans QML files by utility qmlimportscanner. The bug is in the fact that it scans only QML files in head project. If QML files are used in subprojects - they are not scanned. I use QML Map in subproject - this is mandatory needed by task.
Solution - just enough include to head project the dummy.qml file with content:
import QtQuick 2.0 import QtPositioning 5.8 // any other version as needed import QtLocation 5.11 // any other version as needed Item { }
It better add by Add New.../Choose a template/Qt/QML File (Qt Quick 2). I do not know when and how qmlimportscanner is called therefore I added dummy.qml to resources root.
After build both absent libs appear in <build-dir>/android-build/libs/armeabi-v7a folder. Application runs on Android device without error messages shown in first my message.
-
@Gourmet said in QtLocation and QtPositioning modules are not installed...:
I use QML Map in subproject
That's actually an important piece of information!
Glad it's now working for you, and thanks for sharing the answer!