使用aar库与Qt [英] Using aar Library with Qt

查看:1184
本文介绍了使用aar库与Qt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Qt应用中使用Android Studio库(aar文件)?

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

问题是,我想用Qt实现一个移动应用,但是只有一个Android Studio的库。是否可以将该库包含在Qt项目中或者让我为它写一个包装类?

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?

如果我必须实现一个包装器,我必须使用JNI和有什么例子使用它与C ++和一个Java lib?

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?

推荐答案

我发现答案对我有用。

首先你必须解压缩aar文件,这样你可以得到你的jar库文件。
然后你可以按照此链接中的说明将库包含到你的apk中:
http://doc.qt.io/qt-5/android3rdpartylibs.html

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

完成此操作后,您必须实施您自己的Java包装类与库进行交互。因此,你必须使用QAndroidJniObject类从Qt。这里有更多的信息。
http://doc.qt.io/qt-5/qandroidjniobject.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

您还可以看看这个例子,他们使用自己的java类。 http://doc.qt.io/qt-5/qtandroidextras-notification -example.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

这篇关于使用aar库与Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆