Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use my custom library apk file in other applications

Tags:

android

I have my own custom library apk file (say lib.apk) & i want make it available to other applications. How to provide the uses-library in the android manifest.xml file in other apps so as to use my custom library.

like image 760
Arutha Avatar asked Sep 07 '09 13:09

Arutha


People also ask

What is library in Android?

An Android library is structurally the same as an Android app module. It can include everything needed to build an app, including source code, resource files, and an Android manifest.


2 Answers

The <uses-library> element is for add-ons supplied as extensions to the firmware. AFAIK, it will not be usable for your scenario.

Most likely, you will need to implement a service that exposes an API via AIDL, or uses a set of documented Intent actions to exchange data with other applications, or exposes a ContentProvider.

Otherwise, package your code as a JAR, not an APK. You can see many examples of this in my github repositories (all of the cwac- ones follow this pattern).

like image 149
CommonsWare Avatar answered Nov 09 '22 05:11

CommonsWare


When converting from a jar library to and apk library make sure that the reference to the jar is removed from "Java Build Path" -> "Projects" and the library is added to "Android" -> "Library".

like image 40
phreed Avatar answered Nov 09 '22 07:11

phreed