This is the sixth day of my participation in the August More text Challenge. For details, see:August is more challenging
This article should be based on the previous basis before we can continue with the following content. I recommend reading it.
Qt for Android (1) — How to call Android methods in Qt
Qt for Android (2) — How to call a custom Android method in Qt
Qt for Android (3) — Get Android Services in Qt and call c with Context (set volume, brightness, etc.)
There will always be a need to introduce third-party JARS or so libraries to implement some functionality, such as bugly, or other third-party jars. It’s easy to introduce third-party JAR packages in QT for Android. I’ll just outline the steps, but the principle is the same as the native Android approach.
Based on article 2, we first create a new libs folder in the Android directory. If it is a JAR package, put it in the libs folder.
Click the Add button in the image and select the so library you want to add, making sure it is consistent with the ABI you are building. For example, if your project is building the APK of Armeabi-V7a, then add the corresponding version of the SO library. QT Creator automatically adds the so library to your pro file. Open your pro file to see it.
After the addition, the JAR package can be used directly. Whether you create a new Java class to use or use it in Qt, it’s fine. See article 2 about how to use it in Java.
In QT use, you need to pass JNI transfer, first call Java functions, and then through the Java function call Jar package function can be.
A JAR package is just a wrapper around a bunch of class files, just as we would call a normal Java function.