Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved Not Able to Use QAndroidJniObject,QAndroidJniEnvironment,QtAndroid in a Project

    Mobile and Embedded
    5
    7
    781
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Surajkumar Tanurkar last edited by

      I am compiling and creating build for one project,
      but i am not getting error
      /Users/username/Downloads/runtimeMobile/../runtimeMobile/example/example.h:23: error: 'QAndroidJniObject' file not found
      #include <QAndroidJniObject>
      ^~~~~~~~~~~~~~~~~~~

      1 Reply Last reply Reply Quote 0
      • Shrinidhi Upadhyaya
        Shrinidhi Upadhyaya last edited by Shrinidhi Upadhyaya

        Hi @Surajkumar-Tanurkar ,

        have you added below line to your .pro file ?

        QT += androidextras
        

        Shrinidhi Upadhyaya.
        Upvote the answer(s) that helped you to solve the issue.

        1 Reply Last reply Reply Quote 1
        • Pradeep P N
          Pradeep P N last edited by Pradeep P N

          Hi @Surajkumar-Tanurkar
          In addition to @Shrinidhi-Upadhyaya

          Prefer below code if androidextras is not added. so it will not create problem for other platforms.

          android {
              QT  += androidextras
          }
          

          All the best.

          Pradeep Nimbalkar.
          Upvote the answer(s) that helped you to solve the issue...
          Keep code clean.

          A 1 Reply Last reply Reply Quote 1
          • A
            Aayushi @Pradeep P N last edited by Aayushi

            @Pradeep-P-N said in Not Able to Use QAndroidJniObject,QAndroidJniEnvironment,QtAndroid in a Project:

            android {
            QT += androidextras
            }

            Hello, I have added this code to the .pro file but the issue persists.
            My QT version is 5.15.2 , compiler is MSVC2019_64bit.
            QT creator 4.14.0 (community)
            The following error pops up:
            c:\users\admin\downloads\code\build-project-desktop_qt_5_15_2_msvc2019_32bit-debug\debug....\project\mainwindow.h:15: error: C1083: Cannot open include file: 'QAndroidJniObject': No such file or directory
            C:\Users\admin\Downloads\code\project\mainwindow.h:15: error: 'QAndroidJniObject' file not found
            C:\Users\admin\Downloads\code\project\mainwindow.h:16: error: 'QAndroidJniEnvironment' file not found
            C:\Users\admin\Downloads\code\project\mainwindow.h:17: error: 'QtAndroid' file not found

            KroMignon 1 Reply Last reply Reply Quote 0
            • KroMignon
              KroMignon @Aayushi last edited by

              @Aayushi said in Not Able to Use QAndroidJniObject,QAndroidJniEnvironment,QtAndroid in a Project:

              My QT version is 5.15.2 , compiler is MSVC2019_64bit.
              QT creator 4.14.0 (community)

              This is not your Qt version but the IDE version (Qt Creator is an IDE!)

              The following error pops up:
              c:\users\admin\downloads\code\build-project-desktop_qt_5_15_2_msvc2019_32bit-debug\debug....\project\mainwindow.h:15: error: C1083: Cannot open include file:

              If you want to compile for Android, you have to install an Android Qt Kit with Qt Maintenance Tool
              For example:
              ff744617-31fc-40be-8bd4-ed7aeaa4a1a2-image.png

              Then you have to setup your Qt Android environnement: https://doc.qt.io/qt-5/android-getting-started.html

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              A 1 Reply Last reply Reply Quote 0
              • A
                Aayushi @KroMignon last edited by

                @KroMignon Hello, Thank you for the solution. However after installing the prerequisites, I am facing the following problem:
                qt problem.PNG
                May I know where possibly I could go wrong? The following are my settings:
                qt config.PNG
                qt build settings.PNG

                KroMignon 1 Reply Last reply Reply Quote 0
                • KroMignon
                  KroMignon @Aayushi last edited by KroMignon

                  @Aayushi If you want to compile for Android, you have to select an Android Qt Kit.
                  As far as I can see, you are using "Desktop Qt 5.15.2 MinGW" kit not "Android Qt 5.15.2", so you are compiling for Windows not Android

                  It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post