Pirisok
Pirisok

Reputation: 401

Convert a whole android package to jar file in eclipse

i know we can convert a java class file into a jar file , but i want to know , is there any way to convert a whole Android Package into a jar file or another format , so i can use them in another project ?

and if with any way we can convert it , and the main app has some permissions , are they added to second app or i must add them in second app manifest ?

Upvotes: 0

Views: 793

Answers (2)

Markus Kauppinen
Markus Kauppinen

Reputation: 3235

You can create an Android Archive Library i.e. an AAR file (*.aar) if you make your project a library. As far as I know a JAR file cannot contain all the Android specific components of the project. You can find a very brief JAR/AAR comparison in this discussion.

You can have a look at these tutorials by Vogella and Android By Code for creating such a library and you may find relevant Stackoverflow discussions with the "aar" tag. But as this is a rather new feature and support in Android Studio (or Eclipse ADT) has improved from version to version some of the older discussion might not be up-to-date anymore.

The permissions specified in the library's manifest will apply to the library code even in the app. that is using the library. Commonsware has explained the manifest aspect in more detail.

Upvotes: 1

Theo
Theo

Reputation: 154

Firstly, you must go in Eclipse, to File -> Export -> Java (jar file) -> and there you select the package you want to export as a .jar file.

Concerning your second question, you must add the permissions again to the second application.

Upvotes: 0

Related Questions