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. purpose of android folder?

purpose of android folder?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
14 Posts 2 Posters 2.6k Views 1 Watching
  • 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi all -

    I'm trying to correctly build and deploy the example on this page. I notice that the CMakeLists.txt file expects an android folder under the main project folder.

    1. am I expected to create this myself?
    2. what (if anything) do I put into it?
    3. do I need to change any build settings for using it?

    Thanks...

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #2

      You have to have it by yourself or from qt creator. I made it by myself and set all build files(for android and linux with qmake and cmake) under one dir(s)=buildfiles.
      ANDROID_PACKAGE_SOURCE_DIR = $$PWD/../android <==in qmake
      set( ANDROID_PACKAGE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/buildfiles/android CACHE INTERNAL "" ) <==in cmake

      Contents in it are: gradle stuff(generated by qtcreator), AndroidManifest.xml, app icon settings, your interface to android Java, etc.

      mzimmersM 1 Reply Last reply
      1
      • JoeCFDJ JoeCFD

        You have to have it by yourself or from qt creator. I made it by myself and set all build files(for android and linux with qmake and cmake) under one dir(s)=buildfiles.
        ANDROID_PACKAGE_SOURCE_DIR = $$PWD/../android <==in qmake
        set( ANDROID_PACKAGE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/buildfiles/android CACHE INTERNAL "" ) <==in cmake

        Contents in it are: gradle stuff(generated by qtcreator), AndroidManifest.xml, app icon settings, your interface to android Java, etc.

        mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        @JoeCFD when you say "build files" does that mean your source files (.qml, .svg, etc)?

        I have a similar entry in the CMakeLists.txt file from the example, but when I try to run, I get this error:

        W libappaccelbubble_x86_64.so: QQmlApplicationEngine failed to load component
        W libappaccelbubble_x86_64.so: qrc:/bubble/main.qml: No such file or directory
        
        JoeCFDJ 1 Reply Last reply
        0
        • mzimmersM mzimmers

          @JoeCFD when you say "build files" does that mean your source files (.qml, .svg, etc)?

          I have a similar entry in the CMakeLists.txt file from the example, but when I try to run, I get this error:

          W libappaccelbubble_x86_64.so: QQmlApplicationEngine failed to load component
          W libappaccelbubble_x86_64.so: qrc:/bubble/main.qml: No such file or directory
          
          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          @mzimmers no, do not get confused. I have a bunch of pri(s) and cmake files for android and Linux builds. I simply organize them in one dir(buildfiles) + subdirs. android dir is under buildfiles.

          mzimmersM 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @mzimmers no, do not get confused. I have a bunch of pri(s) and cmake files for android and Linux builds. I simply organize them in one dir(buildfiles) + subdirs. android dir is under buildfiles.

            mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #5

            @JoeCFD OK, so then why am I getting the error above? It goes away if I comment out the "/android" part of the line you posted (for CMake).

            JoeCFDJ 1 Reply Last reply
            0
            • mzimmersM mzimmers

              @JoeCFD OK, so then why am I getting the error above? It goes away if I comment out the "/android" part of the line you posted (for CMake).

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by
              #6

              @mzimmers https://doc.qt.io/qt-6/cmake-target-property-qt-android-package-source-dir.html

              mzimmersM 1 Reply Last reply
              0
              • JoeCFDJ JoeCFD

                @mzimmers https://doc.qt.io/qt-6/cmake-target-property-qt-android-package-source-dir.html

                mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #7

                @JoeCFD the example I cited in my original post has this in its CMakeLists.txt file:

                set_property(TARGET appaccelbubble APPEND PROPERTY
                    QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
                )
                

                If I build the example as-is, I get the error I posted. If I comment out the "/android" it works.

                I'm asking why that is.

                JoeCFDJ 1 Reply Last reply
                0
                • mzimmersM mzimmers

                  @JoeCFD the example I cited in my original post has this in its CMakeLists.txt file:

                  set_property(TARGET appaccelbubble APPEND PROPERTY
                      QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
                  )
                  

                  If I build the example as-is, I get the error I posted. If I comment out the "/android" it works.

                  I'm asking why that is.

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #8

                  @mzimmers message( "=============${CMAKE_CURRENT_SOURCE_DIR}") ==>print out to see the path.
                  it is possible that CMAKE_CURRENT_SOURCE_DIR has /android

                  mzimmersM 1 Reply Last reply
                  0
                  • JoeCFDJ JoeCFD

                    @mzimmers message( "=============${CMAKE_CURRENT_SOURCE_DIR}") ==>print out to see the path.
                    it is possible that CMAKE_CURRENT_SOURCE_DIR has /android

                    mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #9

                    @JoeCFD

                    =============C:/Users/Michael.Zimmers/Qt_projects/bubble
                    

                    bubble.PNG

                    JoeCFDJ 1 Reply Last reply
                    0
                    • mzimmersM mzimmers

                      @JoeCFD

                      =============C:/Users/Michael.Zimmers/Qt_projects/bubble
                      

                      bubble.PNG

                      JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by JoeCFD
                      #10

                      @mzimmers sorry I did not realize this one QT_ANDROID_PACKAGE_SOURCE_DIR was introduced in Qt6. Mine is ANDROID_PACKAGE_SOURCE_DIR in qt 5 apps. It is the case that QT_ANDROID_PACKAGE_SOURCE_DIR does not need /android. I have not started to use Qt6.

                      1 Reply Last reply
                      1
                      • mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #11

                        Oh...so this is something of a Qt 5 artifact? OK, that makes sense...I guess whoever maintains the Qt examples missed this (I did pull it from the Qt 6 examples).

                        So...now, let's turn this question around: let's say I want to use this folder, so all those Android files don't clutter up my main folder. How do I enable that?

                        JoeCFDJ 1 Reply Last reply
                        0
                        • mzimmersM mzimmers

                          Oh...so this is something of a Qt 5 artifact? OK, that makes sense...I guess whoever maintains the Qt examples missed this (I did pull it from the Qt 6 examples).

                          So...now, let's turn this question around: let's say I want to use this folder, so all those Android files don't clutter up my main folder. How do I enable that?

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by
                          #12

                          @mzimmers do not mess up with android folder unless it is necessary. I put it under buildfiles since you may have some .cmake files.

                          mzimmersM 1 Reply Last reply
                          0
                          • JoeCFDJ JoeCFD

                            @mzimmers do not mess up with android folder unless it is necessary. I put it under buildfiles since you may have some .cmake files.

                            mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #13

                            @JoeCFD OK, so do I need this folder under my main project folder? So far, it looks like I can do without it.

                            JoeCFDJ 1 Reply Last reply
                            0
                            • mzimmersM mzimmers

                              @JoeCFD OK, so do I need this folder under my main project folder? So far, it looks like I can do without it.

                              JoeCFDJ Offline
                              JoeCFDJ Offline
                              JoeCFD
                              wrote on last edited by JoeCFD
                              #14

                              @mzimmers You can put it anywhere, but set its path with QT_ANDROID_PACKAGE_SOURCE_DIR. You do not need it now because all its contents may have been copied into android-build. Where does your app get AndroidManifest.xml if your build dir is removed? This dir is part of your android app.

                              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