1

I have a doubt : Jar library vs Android Library

Which is the difference ?

In jar library I can't use Android's methods, but I can only use java's functions; right ? (for example I can't use the android's method for Json)

EDIT : I have read the below answer and I have understood that I can use Android SDK inside the JAR file. The question is : How can I use method from Android SDK in a JAR file ?

Thus if I want to use a library's function to write on my webview, I think is better that I use the Android Library. Is it Right or I commit some mistake in my reasoning ?

1 Answer 1

2

Which is the difference ?

Quoting the documentation, with emphasis added:

An Android library module is a development module that holds shared Android source code and resources.

An Android library module (formerly known as an Android library project) also supports packaging assets, NDK libraries, and manifest entries, whereas a plain JAR does not.

In jar library I can't use Android's methods, but I can only use java's functions; right ?

No, you can create a JAR that uses classes and methods from the Android SDK.

3
  • Thanks for the rapid answer :) I edit the question, because after you answer I have another question : How can I use method from Android SDK in a JAR file ?
    – aeroxr1
    Feb 28, 2015 at 17:12
  • 1
    @aeroxr1: That depends a lot on your development toolchain. Basically you want to create a regular Android project/library module/whatever, one that is set up to compile against the Android SDK. You avoid using resources and create a JAR out of the results. So, most of my CWAC libraries, like CWAC-RichTextUtils, consist of an Android library module, and I have a Gradle task that can create a JAR out of the results that I publish for Eclipse users. Feb 28, 2015 at 17:36
  • thanks for your time :) The topic is much complex for me :( When you have the time, can you post to me some link or guide or book's title where is been explained this argument ? Thanks ! Very thanks :)
    – aeroxr1
    Feb 28, 2015 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.