1

In my project, there are many library project (more than 10). It takes long time to build. So I want to replace some of these library projects by JAR libraries.

According to this question: How to Convert an Android Library Project to an External JAR?

As CommonsWare's answer (https://stackoverflow.com/a/7973950/190309)

If your library is purely Java code, with no resources, you can create a JAR out of the .class files, just as you would with regular Java.

But when using NineOldAndroids library (https://github.com/JakeWharton/NineOldAndroids) from Jake Wharton,

This library is presented as a .jar file which you can include in the libs/ folder of your application.

It means although there are many resources in NineOldAndroids, I can use it as a JAR library instead.

With ADT 17, for every library project, there is a JAR library in lib_project/bin/lib_project.jar which automatically generated each time library project is built.

Can I use this JAR as an alternative for library project?

Community
  • 1
  • 1
anticafe
  • 6,816
  • 9
  • 43
  • 74

3 Answers3

3

It means although there are many resources in NineOldAndroids

There are precisely zero resources in NineOldAndroids. You can tell this by looking at the project and seeing that there is no res/ directory.

With ADT 17, for every library project, there is a JAR library in lib_project/bin/lib_project.jar which automatically generated each time library project is built.

Can I use this JAR as an alternative for library project?

Not at this time. That JAR still depends on the library project itself.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
1

I have tried and documented this issue in how-to-consume-reusable-gui-element-widget-with-resources-in-android and i didn-t succeed with adt-17. but maybe i did something wrong.

CommonsWare-s answer to my qestion says

 > Eventually (which now appears like it will be the R18 version of tools or later), the 
 > tools should support packaging reusable components in a JAR, with resources, in 
 > such a manner that you can add them to a host project and the resources will 
 > be blended in automatically. Right now, that's not an option.
Community
  • 1
  • 1
k3b
  • 14,517
  • 7
  • 53
  • 85
  • Yeah, and R18 (and R19) have come and gone without this feature yet being added. I have given up predicting when they will ship this capability. :-( – CommonsWare Apr 16 '12 at 15:54
0

If you look into the jar generated for a library project, you'll see there is no resource in it. It is only used for the Java classes.

njzk2
  • 38,969
  • 7
  • 69
  • 107