19

I initially thought it was exclusively for official libraries like the support library. However any time I add a custom JAR using the "Add to build path" menu item, it automatically shows up in both "Referenced Libraries" and "Android Private Libraries". One of these is redundant since there is no point in exporting both at build time. Additionally, "Android Private Libraries" cannot be modified so I can't (easily) add java doc or source paths. Not to mention it just seems wrong that a custom JAR is in "Android Private Libraries".

I cannot delete the entry from "Android Private Libraries" to use only "Referenced Libraries" either.

Monstieur
  • 7,992
  • 10
  • 51
  • 77
  • 1
    To add javadoc and source path to JAR files in /libs directory, please refer to this answer: http://stackoverflow.com/a/13963000/94148 – aleung Jan 11 '14 at 16:51

3 Answers3

7

In my case i always add libraries to libs folder.

According to my understanding thats the way its suppose to be. Android Private Library folder references these jars in libs folder. The Android Private Library is used during the creation of apk (probably during the conversion of your java code into dex file).

Sheraz Ahmad Khilji
  • 8,300
  • 9
  • 52
  • 84
  • So manually adding JARs to the build path is no longer required now? As soon as I paste a JAR in the "libs" folder it is automatically referencable from code because it shows up in "Android Private Libraries" (which is in the build path). – Monstieur Dec 16 '13 at 07:21
  • @Kurian Yes that's correct after you add the jar in libs. You don't need to reference them manually. After adding jars in libs they are automatically reference able and You should also check the Android Private Libraries folder and that's it. Check this answer for more help http://stackoverflow.com/a/16642869/1118886 – Sheraz Ahmad Khilji Dec 16 '13 at 07:28
  • It really helped me a lot after googling for a long time.Yea if you add jar files to libs folder,it gets automatically included in android private libraries. – ajarmani Mar 15 '14 at 16:40
  • @SherazAhmadKhilji, **Doesn't answer the question**. Do you mean that "Referenced Libraries" aren't included in the apk? If both "Referenced Libraries" and "Private Library" are included in the apk, then what's the difference? – Pacerier Nov 14 '14 at 06:58
1

I don't have any problem with custom jars. They are only in Reference Libraries in my case. I suggest you to look at Order and Export tab in java build path properties.Just check all the custom jars and uncheck all the Android specific libraries. If you want all jars in Reference Libraries then check all jars and clean your project.

enter image description here

Sunny
  • 14,522
  • 15
  • 84
  • 129
  • 1
    The JAR shows up in Android Private Libraries as soon as I paste it in the "libs" folder. It cannot be deleted or unchecked from "Android Private Libraries". It additionally shows up under "Referenced Libraries" and even if I remove this from the build path the library is still usable in code since it's in "Android Private Libraries". – Monstieur Dec 16 '13 at 06:27
  • Are you saying that all jars you pasted in libs folder appear in Android Private Libraries? – Sunny Dec 16 '13 at 07:05
  • 1
    Yes. As soon as I paste it gets added there. It's directly usable from my code after that. To make it show up in "Referenced Libraries" I need to manually click "Add to build path" as usual for Java, but this seems redundant now. – Monstieur Dec 16 '13 at 07:19
  • In my case not all jars are there in Android Private Libraries only `google-play-service.jar` and `android-support-v4.jar` appears. All others jars are only in `Reference Libraries`. – Sunny Dec 16 '13 at 07:56
0

you just need to put jar and jardoc to a folder but not the folder "libs". Then there will be a 'Reference Library', Then you can add jardoc to jar by properties of jar in Reference Library.

1: New a Folder named sth but not "libs" like folder named 'lib'. 2: Put your .jar and .jardoc in the new folder the folder 'lib' in this tutorial 3: Add the jar and jardoc to project. Then, a 'Reference Libraries' will appear 4: Delete original jar/jardoc.jar in libs (if you've imported them to libs before). 5: add XXXjavadoc.jar to XXX.jar as doc location.

A King
  • 1