Import custom framework extension in Android Studio - android

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.

Related

Android NDK - Native Library add to already existing Android Java Library

I have gone through all the Android NDK tutorials and built a few simple examples. It seems to me that every example out there from Android Studio revolves around creating a native library attached to an Android application directly. I need to create a native library that is attached to an already existing Android Library. I don't see an example to do this. Is it even possible to hang a native C++ library off an already existing Android Java Library, so the Android Library has access to those native methods, without attaching both libraries (android and native) to a specific application?
Tried in Android Studio to attach a C++ native library to an already existing Android Library, and used CMake as compiler choice, the gradle does not seem to support. The CMakeLists.txt does not seem to be recognized, the "includes" folder is not generated to support the .cpp in the cpp folder, and the native library generates no links I can see to the Android Library methods.

Creating Android Library using QT

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.

In Unity android app, how to receive content from a service of a referenced android library

I want to use an android library in Unity. The library contains a service which delivers some content to consume in your app. For native android apps (apps programmed using java), this content can be easily received by extending the library's service in the application. But I want to use this service (in fact the content that this service provides) in a Unity application. Can anyone explain how to do this?
First you can't use .aar library files inside unity because the new format for Android Archives (.aar) is integrated with the new Gradle build system, however, Unity does not use that when building the project for Android yet.
So , you can compile your .aar file , extract it, and use the classes.jar to access the java classes inside the project you have. ( I've used this method when I converted from Eclipse to Android Studio ).
You need to create a plugin. Export android project from unity that can be opened in eclipse or Android Studio. Write the code there. Unity has document here that will help you in communication between unity and native android.

Testing my android library without compile

I would like to test my library in an android application, but I would like to avoid compiling and moving around .jar files.
In Xcode for iOs development, it's possible to add your library project in your workspace inside your other project (a test app) and when you run your test app, it builds the library and links everything up correctly.
Can I do this for Android development in Eclipse? How can I do this?
I tried to add a library but it seemed very manual which isn't ideal on time.
The important thing here is that I do have Android references and dependancies, so i can't just unit test the library by itself. I am also creating an SQLite database which I would like to inspect during development.
I guess you are asking about Android Library projects, otherwise you can just test your library using JUnit.
In such case, the post android: testing library projects gives you a step by step guide on how to proceed to test the Android Library project in a stand-alone fashion. Think it can also be tested through the tests belonging to the Android project that uses the library.
You can test your library code using RoboElectric that allows you to test without the need of deploying an android emulator.
Or you can set your library project as an Android library project and put the test in the first project. link
In latest android SDK tools you do not need to add jar in build path, they will be added automatically.
you can put you jar file in libs folder of your project, But it will defiantly be compile before running.

How to use an Android stock app as a library in another custom Android app?

I have downloaded Android source code and set up a build environment.
I want to use the Android stock Mms app as a library from my custom app, so that I can use the functionalities of Mms. So, I modified the Android.mk file of the Mms app by including the BUILD_SHARED_LIBRARY template, and build it (by $ mmm packages/apps/Mms) to generate a "MmsLib.so" file.
Then, in my custom app's make file, I have LOCAL_SHARED_LIBRARIES := MmsLib.so, to refer to the Mms shared lib. But when I build my custom app, it throws error as it cannot find symbols for classes of Mms lib.
Any help is appreciaited !
There is no native code in the current AOSP copy of the MMS application. Hence, your MmsLib.so file is probably empty.
You are welcome to take the Android project and attempt to turn it into an Android library project. However, it is unlikely that this will work, as the AOSP applications are only designed to be built as part of a full firmware build, not as a standalone Android SDK project, let alone an Android library project.

Categories

Resources