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. How to add aar Android libraries?

How to add aar Android libraries?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 4.5k 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.
  • L Offline
    L Offline
    lqsa
    wrote on 28 Jun 2016, 20:46 last edited by
    #1

    I need to use Google Firebase. After installing the Android SDK, it appears on the extras directories like a various aar files.

    After reading [http://doc.qt.io/qt-5/android3rdpartylibs.html](link url), I've created a project.properties file and put these inside:

    android.library.reference.1=support-annotations/
    android.library.reference.2=support-v4/
    android.library.reference.3=play-services-basement/
    android.library.reference.4=play-services-tasks/
    android.library.reference.5=play-services-base/
    android.library.reference.6=firebase-auth-module/
    android.library.reference.7=firebase-common/
    android.library.reference.8=firebase-auth-common/
    

    In every of these directories, I've unzipped the aar file.

    When compile the QT project, the APK generated doesn't contains any of these files, and the application crash because can't found required classes.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Carmoneer
      wrote on 28 Jun 2016, 21:18 last edited by
      #2

      Do you have "Use Gradle" checked under Projects > Build > Build Android APK settings?

      I had a similar issue and that ended up resolving it for me. When I switched to a newer Qt version, I had to re-check that setting and it found the classes as expected.

      L 1 Reply Last reply 28 Jun 2016, 22:20
      0
      • C Carmoneer
        28 Jun 2016, 21:18

        Do you have "Use Gradle" checked under Projects > Build > Build Android APK settings?

        I had a similar issue and that ended up resolving it for me. When I switched to a newer Qt version, I had to re-check that setting and it found the classes as expected.

        L Offline
        L Offline
        lqsa
        wrote on 28 Jun 2016, 22:20 last edited by lqsa
        #3

        @Carmoneer Yes, it's checked.
        Please, could you put your project.properties and show how is your tree directory? and, on the library directory, have you unzipped the aar? Have you put anything on the pro file?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Carmoneer
          wrote on 29 Jun 2016, 13:52 last edited by Carmoneer
          #4

          I don't know how much this will help you. My project was working with straight lib project folders, not .aar files. Since you unpacked the .aar files, they should have a similar structure as a lib project folder. You'll likely have to do some tweaking/trail & error to get it to work. Below is the basis of how I was able to get it work.

          Note(): There is likely a less kludgy way of doing this, but this I found to work on Qt 5.6.0 and haven't looked back.

          ProjectFolder
          +-cppClassFolders
          +-... 
          +-android
           |  +-bin
           |  +-...
           |  +-libs <-- did not work when placing project lib folder itself  in 'libs' folder
           |     +-.jarFiles
           |  +-src   
           |     +-com/my/app
           |     |  +-main.java
           |     +-myLib   <-- lib project folder(s) inside src
           |     |  +-src/main
           |     |     +-java/com/app
           |     |     |  +-.java files
           |     |     +-res
           |     |     |  +-res files
           |     |     +-AndroidManifest.xml
           |     |  +-build.gradle
           |  +-AndroidManifest.xml
           |  +-build.gradle
           |  +-project.properties
          +-myApp.pro
          
          project.properties
          --------------------
          # Project target.
          target=android-19
          android.library.reference.1=src/myLib/
          
          PRO File
          --------------------
          Nothing added to .pro file pertaining to the lib project folder added.
          

          This isn't exactly the issue your facing, but hopefully this helps to steer you in the right direction. Take care and good luck!

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lqsa
            wrote on 29 Jun 2016, 23:12 last edited by
            #5

            Finally it worked for me modifying the build.gradle file and simply adding the dependencie:

            dependencies {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            compile 'com.google.firebase:firebase-auth:9.2.0'
            }

            Also, I've deleted the directories referenced on the project.properties and the project.properties file. Thanks a lot!!

            1 Reply Last reply
            0

            3/5

            28 Jun 2016, 22:20

            • Login

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