Using aar Library with Qt

为君一笑 提交于 2019-12-01 00:04:31

I found the answer, that worked for me.

First you have to unzip the aar file, so you can get your jar library file. Then you can follow the instructions in this link to include the library to your apk: http://doc.qt.io/qt-5/android3rdpartylibs.html

When you have finished this, you have to implement your own Java wrapper class to interact with the library. Therfore you have to use the QAndroidJniObject class from Qt. Here are more information about it. http://doc.qt.io/qt-5/qandroidjniobject.html

You could also have a look at this example, where they use their own java class. http://doc.qt.io/qt-5/qtandroidextras-notification-example.html

You can add .aar files directly to your project

In gradle file add .aar folder to dependencies

compile project(':myAarFolder1.1')

and include it in gradle.settings

include ':myAarFolder1.1'

the aar file location in my project is like this

android/myAarFolder1.1/.aar
android/myAarFolder1.1/build.gradle

android/myAarFolder1.1/build.gradle file content

configurations.maybeCreate("default")
artifacts.add("default", file('myAarFolder1.1.aar'))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!