Androrider
Androrider

Reputation: 1070

Create Android apps in Eclipse sharing common library

is it possible to create java libraries the apps can use shared?

It is totally clear to me how to create a library project and how to use it while shared between several another projects, compile each project into different apps. But in this case the library gets compiled into each app separated.

What I want is to create a library, compile it, install it into the device (or emulator) and several apps calling into this library.

And when it is needed to change something the apps use shard in this library, I just re-work the library, re-compile it, replace it on device (or emulator), and the apps use the new library, all apps use the new functions.

Is it possible?

I googled it, but I couldn't find the solution.

I am using Win + Eclipse, I can't use native code (since I know only Java).

Thanks

UPDATE: Thank you for your suggestions, I know about using Services and Activities started explicitly in order to share functionality. I asked about libraries because I am investigating the possibilites. If there is no way to use common library, what is the purpose of uses-library... in the app manifest?

Thank you

Upvotes: 1

Views: 695

Answers (2)

Mitch
Mitch

Reputation: 1039

The Android model installs each application as a separate user (UID) on the device and the users have no access to other application's/user's files. Therefore, you can't share libraries as such.

As Yury suggested, you might need a service or an activity that can be invoked from multiple applications.

Upvotes: 1

Yury
Yury

Reputation: 20936

It's more likely that you need a service as a library. Have you considered this possibility? You can create it as a separate application, define an interface for your service and use it in other apps. So as the interface does not change this will not influence on other apps that depends on this service.

Upvotes: 1

Related Questions