Home:ALL Converter>Using aar Library with Qt

Using aar Library with Qt

Ask Time:2015-10-15T19:43:37         Author:C.Fabi

Json Formatter

is it possible to use a Android Studio Library (aar file) in a Qt app?

The problem is, that I want to implement a mobile App with Qt, but there is only a library for Android Studio. Is it possible to include the library in the Qt project or have I to write a wrapper class for it?

If I have to implement a wrapper, do I have to use the JNI and are there any examples for using it with C++ and a Java lib?

Author:C.Fabi,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/33147640/using-aar-library-with-qt
C.Fabi :

I found the answer, that worked for me.\n\nFirst you have to unzip the aar file, so you can get your jar library file.\nThen you can follow the instructions in this link to include the library to your apk:\nhttp://doc.qt.io/qt-5/android3rdpartylibs.html\n\nWhen 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.\nhttp://doc.qt.io/qt-5/qandroidjniobject.html\n\nYou 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",
2015-10-19T05:14:13
mohammad alabid :

You can add .aar files directly to your project\n\nIn gradle file add .aar folder to dependencies \n\ncompile project(':myAarFolder1.1')\n\n\nand include it in gradle.settings\n\ninclude ':myAarFolder1.1'\n\n\nthe aar file location in my project is like this\n\nandroid/myAarFolder1.1/.aar\nandroid/myAarFolder1.1/build.gradle\n\n\nandroid/myAarFolder1.1/build.gradle file content\n\nconfigurations.maybeCreate(\"default\")\nartifacts.add(\"default\", file('myAarFolder1.1.aar'))\n",
2017-07-20T07:51:46
yy