Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Not Able to Use QAndroidJniObject,QAndroidJniEnvironment,QtAndroid in a Project

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

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 5 Posters 1.8k Views
  • 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 Offline
    S Offline
    Surajkumar Tanurkar
    wrote on last edited by
    #1

    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
    0
    • Shrinidhi UpadhyayaS Offline
      Shrinidhi UpadhyayaS Offline
      Shrinidhi Upadhyaya
      wrote on last edited by Shrinidhi Upadhyaya
      #2

      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
      1
      • Pradeep P NP Offline
        Pradeep P NP Offline
        Pradeep P N
        wrote on last edited by Pradeep P N
        #3

        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
        1
        • Pradeep P NP 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.

          A Offline
          A Offline
          Aayushi
          wrote on last edited by Aayushi
          #4

          @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

          KroMignonK 1 Reply Last reply
          0
          • A 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

            KroMignonK Offline
            KroMignonK Offline
            KroMignon
            wrote on last edited by
            #5

            @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
            0
            • KroMignonK KroMignon

              @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

              A Offline
              A Offline
              Aayushi
              wrote on last edited by
              #6

              @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

              KroMignonK 1 Reply Last reply
              0
              • A Aayushi

                @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

                KroMignonK Offline
                KroMignonK Offline
                KroMignon
                wrote on last edited by KroMignon
                #7

                @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
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved