Creating Android Library using QT - android

I tried searching for a solution but the only answers i found were the other way around (using the AAR inside QT).
I am developing an android app inside QT creator.
All is working fine. Now i need to make the core of this app as a library that can be distributed to android developer to be used in their code (like an AAR).
Is that possible to be done?
If so, how to do it and how to import it in other development tools (android studio/ eclipse ...)?

The easiest way is to compile your library using QtCreator and then send people the generated .so file with the header files. Then people can link with the .so file and use the header files to call the functions or instantiate the classes packaged in it.
Check this link to see how to build a library with QtCreator:
https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application
Note that you'll need to compile both armv7 and x86 targets and send both .so files if those two targets are needed.

Related

Can or how Android studio use c++ static library *.lib (compiled for windows)?

Our project needs a third party library from another company and it is not open source. They provided *.h and *.lib compiled for windows (linux as well), but no cpp.
I didn't think android could use it but I still have tried it in NDK because I have never touch android studio before.
There are many questions, but it all comes to the question, is it possible to use *.lib in android studio(or VS cross-compile) without the cpp of that library?
If the answer is no, I think the only option for us is to request the android version of the library (*.so and *.a files). Is this correct?

Import custom framework extension in Android Studio

I'm desperately trying to make an application for Android using Android Studio.
Here is my problem:
I'm using a custom android rom on my Pandaboard, and I created a framework extension (java library) which is included in my rom's system.
That means that I have :
/system/framework/com.stooit.MyLib.jar
/system/etc/permissions/com.stooit.MyLib.xml registering my lib.
However, I just can't find a way to include it Android Studio and compile my application.
I tried to include the generated .jar of my lib into Android Studio, however the content is not recognized (the jar is mainly composed of a classes.dex that contain my lib).
Then, I tried to make a new jar with eclipse of my lib, then include it in Android Studio, mark the library as "provided" and then run my application on my board. However, no luck, it just crashes. It doesn't manage to locate the library.
So that's why I'm asking you: Is it even possible to do what I'm trying to do?
The other way I have (but I'd like not to use it) is to copy/paste by android application into my android sources, make an Android Makefile, import my library and build the app with my rom.
Thanks for your help.

Install app on genymotion device ,meet:“INSTALL_FAILED_CPU_ABI_INCOMPATIBLE”

When I install my app on a genymotion simulater device,it can not be installed well,on console I got "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"
I trid another app,it installed fine.I do not know why.
The application (certainly a game) must be ARM only.
Genymotion is a x86 platform, so compile the application to target x86.
You may be able to install ARM support manually :
http://forum.xda-developers.com/showthread.php?t=2528952
If you are using IntelliJ it may be related to the project's default configuration. IntelliJ will assume, unless otherwise specified, that Native libraries will be stored in the Libs folder. This is usually where developer store their JAR libraries. IntelliJ build process will package up the JAR file into the Native file folder in the APK.
If you experiencing this problem, you can find a good How-to:
INSTALL_FAILED_CPU_ABI_INCOMPATIBLE Intellj
This helped to resolve the issue I had.
You might want to check out my answer here:
INSTALL_FAILED_CPU_ABI_INCOMPATIBLE on device using intellij
I know it's written for IntelliJ, but you could be running into a similar issue with Eclipse where it thinks that some normal Java files or jar libraries are native code and including it in the compiled APK. A quick way to find out is to open up the final APK (it's just a jar file, so most utilities should be able to decompress it) and make sure that the only things you see are META-INF, res, AndroidManifest.xml, classes.dex, and resources.arsc. It's possible that there are other valid files in a normal Java Android application, but in general if you see anything else in there, particularly a libs folder, it's probably the result of the compilation process thinking that those other things are native libraries (compiled C/C++ code using the JNI).
If this is the case, you'll need to configure Eclipse to not interpret the Java libraries you're using as native code. Now, I don't personally use Eclipse so I don't know where the proper settings would be, but based off of this answer, it looks like Eclipse automatically assumes that the libs folder in the root of your project contains native libraries. The easiest solution may be to move any Java libraries you are using into a different folder (such as libraries).
http://blog.iteedee.com/2014/02/android-install_failed_cpu_abi_incompatible-intellj/
The INSTALL_FAILED_CPU_ABI_INCOMPATIBLE error is generated when you attempt to install an android application on a device with an unsupported CPU architecture. This error is usually related to the native libraries that are not packaged up for the device’s CPU architecture (ie: x86, ARMv6, ARMv7, etc).
Now, if you have an application that doesn’t use any native libraries or *.so file you might be scratching your head on this one. If you use IntelliJ IDEA IDE for your android development it might be packaging all of your related .JAR file in to the Native Library file location in your APK.
The cause of the same problem was different in my case.
I had added some dependency jars in /libs directory of my Android app project. One of these jars had exported library in jar format; i.e. a jar within a jar file. I've noticed that the apk created using jars with such structure are incompatible with x86 based devices (don't know why).

Recompile shared Android library for Linux

I'm trying to use an SDK (provided by a third party, not Android SDK) for Android (ARM) that implements functionality in native code, unfortunately what I'm trying to do requires a central server as well. All I have is the compiled .so file (and a jar that interfaces to it), I know this is a reach but is it possible to recompile it to run on a normal Linux (x64) box?
I figure it probably wont work cuz of differences between JNI and Android NDK interface but I thought I'd ask here before I throw in the towel on the idea.
First of all Android sdk contains .jar files only and no .so files.
The .so files to which .jar is linked to is already present in devices as a part of Android OS.
So for linux, compile the Android source code for x86 and you will get all the .so for x86.
Once you compile the android source code it also creates sdk for the respective architecture.
But I think .jar should be same for all architecture as java is architecture independent.

How do I add an Andrioid NDK-built shared library to my APK without using NDK?

Pretty much exact duplicate of Add a native lib to an APK. Since there was no answer I decided to ask again.
I have an Android project. I have an .so library built with android NDK. And I want to use this .so in my project, preferrably - without using NDK.
So, how do I tell Eclipse (or Android tools) that I need certain .so to be built into my APK?
It's actually easier than I expected. All I had to do is place the .so in libs/armeabi-v7a - Eclipse saw it and integrated into APK.
However, I've made this project by copying from another Eclipse project, which was actually building this .so from source. So, I think there were some settings that I would otherwise need to set. Feel free to add corrections or edit my answer.

Categories

Resources