Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between Jar, Android Library and Android Library Project

Tags:

android

As I understand, the three ways of distributing my application are via Jar, Android Library and Android Library Project.

Jar - cannot contain resources or XML layouts (so this is out for me)

Android Library - I don't really know how this works but the Google API uses it...

Android Library Project - includes resources but allows the client free rein on the code as it is distributed as source.

If I am to create a closed source application that requires drawables and XML files that I want to distribute to other Android programmers, what should I use? And can someone direct me to a tutorial on creating an Android Library?

like image 945
jax Avatar asked Jul 15 '10 04:07

jax


People also ask

What is the difference between JAR and library?

A JAR serves the same function an an Assembly in the C#/. net world. It's a collection of java classes, a manifest, and optionally other resources, such as properties files. A library is a more abstract concept, in java, a library is usually packaged as a JAR (Java ARchive), or a collection of JARs.

What is the difference between JAR and AAR?

The main difference is aar is splitted inside android to jar. If your app will be used only in user app only in android studio then aar is preferred. If you are planning for app to communicate with c/c++ compiled lib.so file jar is preferred.

What is Java library Android?

Like the small description of each project type says, a Android Library is just another Android Application project,often referred to as Module.And Java Library is another word for a java project.The only difference between a module and a project is the complexity.

What are JAR files Android?

jar JAR file is only used for the Java compiler before deployment on an Android device. It is not bundled with your application. By default, all calls to the provided Android. jar throw exceptions, this allows you to write tests that do not depend on any Android platform behavior.


1 Answers

More details on what exactly does your project would be welcome. My understanding is that you want to sell a library (a set of components/tools developers can integrate in their app) without disclosing the source.

As you stated, you can't include assets/resources in Jar files.

An Android Library Project would force you to let the source code be "visible". Proper licensing terms could help you put legal fences around source code usage but... well, you know what people do with licenses... Maybe some code obfuscation (not on the public visible methods) could help.

I'm not sure about how "shared libraries" included with <uses-library> work, but the examples have seen are system dependent (maps API available only on "official" Google accepted devices, Sprint Evo front facing camera...) and might require to be built within the system. Maybe some root privilege could help adding one, but this would have to be done on EACH device where applications using your library would want to run...

like image 176
Kevin Gaudin Avatar answered Sep 27 '22 22:09

Kevin Gaudin