[Solved] Maps and Android



  • Good morning all,
    i'm new on Qt and i'm trying to develop my first app, for Adroid, with Qt5.3 and Qml on Ubuntu.
    My goal is to build a map into my application, i will try to show my situation better:

    • First i figured out to use Google Maps Api using a WebView element, but then i saw that QtWebKit is still not supported on Adroid.
    • Then i tryed to use QtLocation Plugin, without succes:

    I tryed to istall QtMobility module, but i saw it's not supported too

    I read that QtMobility was included in the main module, so i tryed to just import QtLocation 5.0

    Both my attempts failed.

    Does anyone can help me working around this problem?
    I'm ready to any solution, if possible i'd like to use Qml only.
    Thanks to anyone for answer, i'm avaiable for any other information that can help!

    Ps.Tomorrow, on the 10th od December, there will be the release of Qt5.4. I read QtWebKit and QtWebEngine will not be supported on Android, but if someone knows any other solution that Qt5.4 can bring it's ok for me.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can use "QtWebView":http://qt.gitorious.org/qt/qtwebview/ on Android and iOS to have a native WebView to use in your application.

    Hope it helps



  • First of all thanks for answering!
    I read about your link and it really seems to be what i was searching for, thank you again.

    As i said i'm new on Qt so the next step has been looking for information about how to install the module. I read many pages like "Get the source":http://qt-project.org/wiki/Get_The_Source , "Qmake Tutorial":http://qt-project.org/doc/qt-5/qmake-tutorial.html and other modules documentation.

    It seems that what i need to do that is something like:
    "
    Build And Usage

    Checkout the source code from gitorious Go into the source directory and execute:

    @qmake
    make
    make install@
    The last command will install QtWebSockets as a Qt module.
    To use, add websockets to the QT variable.
    @
    QT += websockets@
    "

    "This is":https://qt.gitorious.org/qt/qtwebsockets/source/7aeea581882425be657123d2945c7165c7063aab:README.md the most clear thing i managed to read.

    So what i did after this is:

    • to donwload the module (i found easier to use the "donwload" button)
    • extract it on <myPath>/Qt/5.3/android_armv7/qml
    • from a terminal i went on <myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src and i tryed @qmake -o MakeFile webview.pro@

    But then i received the message:

    @qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory@

    Then i didn't manage to continue my workflow. Mybe this is out of the original problem i asked in the post, but may someone help me continuing the work flow?

    I know i've been talkative, but i tryed to be as clear as i could!

    Thank you again anyway,SGaist!



  • Still working on it.
    I found that i had problems with qmake, obvious actually.
    So i read some forums and i used: @sudo apt-get install qt4-qmake@

    Then i tryed again the same command as before: @qmake -o MakeFile webview.pro@

    and @qmake webview.pro@

    The termina say: @<myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src/webview/webview-lib.pri:36: Unknown test function: qtHaveModule
    WARNING: <myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src/webview/webview.pro:3: Unable to find file for inclusion qt_build_config
    WARNING: <myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src/webview/webview.pro:12: Unable to find file for inclusion qt_module
    Project MESSAGE: Warning: unknown QT: quick
    Project MESSAGE: Warning: unknown QT: qml
    @

    If i use only @qmake@

    i had @WARNING: <myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src/webview/webview.pro:16: Variable INCPATH is deprecated; use INCLUDEPATH instead.
    <myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src/webview/webview.pro:87: Parse Error ('first: all')
    Error processing project file: <myPath>/Qt/5.3/android_armv7/qml/qt-qtwebview/src/webview/webview.pro
    @


  • Lifetime Qt Champion

    Don't use the qmake from the qt4-qmake package, use the qmake of your android built Qt, so use the full path to it.


  • Moderators

    Hi,

    I believe Qt 5.4 contains a pre-built copy of Qt WebView. (At least, the MSVC version does; I'm not sure about the Android version)



  • Thank you again for your answers.

    I tryed to use the command "qmake" from my QtCreator, under the "Build" menu, but it didn't worked since i still have the error: @Project ERROR: Unknown module(s) in QT@

    But i had some doubts on the workflow:

    • did you, Sgaist, mean the "qmake" command by the "Build" menu?
    • in which forlder have i to paste the module? i tryed:

    <myPath>/Qt/5.3/android_armv7/qml

    <mypath>/Qt/5.3/android_armv7/include

    <myPath>/Qt/Tools/QtCreator/bin/qml

    • which code line have i to add in my .pro file?

    The import statement could be @import QtWebView 1.0@

    as i found in the documentation.


  • Lifetime Qt Champion

    If it's the qmake corresponding to the android Qt you have installed, then yes. But in this case you should rather do it from the command line since you'll have to install it afterward.

    However, you should rather update to 5.4 since it's became an official module in that version



  • I followed your advice SGaist (thank you again!) and i installed Qt5.4. Druing the installation i saw actually the "Extras" QtWebView 1.0 and i was really happy of that, finally.

    Now i'm on my project again, but problems seem not to be finished. QtCreator doesn't recognize the import statement @import QtWebView 1.0@

    and therefore it doesn't recognize the WebView element in my page.

    I tryed to find some official documentation but i only found "this":http://doc-snapshot.qt-project.org/qt5-5.4/qml-qtwebkit-webview.html and it seems not to be the WebView element i was looking for, but the "old one" as it asks to me to import the WebKit 3.0.

    i'm feelling as i'm doing an obvious mistake somewhere, but i will be very happy from any your suggestion!



  • you found different example of qtwebview.
    here is the link for the example.
    http://doc.qt.io/qt-5.4/qtwebview-minibrowser-example.html

    And actually, if you installed Qt5.4 with extras QtWebView, that example also available on Welcome Page > Examples Page.



  • I wonna thank you all, finally i managed to solve my problem. The solution has been the update at qt5.4.

    Best upgrade i ever did! :)

    Thank you again, mikyago.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.