How do I add a new library to android dependencies

2019-03-27 11:03发布

问题:

I am trying to add external library to android dependancies using eclipse adt. I have a couple of libraries like pull to refresh etc in there. But everytime I add a new library jar file it shows outside of the android dependancies library folder. How do I make it such that it is coupled with the other libraries as a part of android dependancies library. Here's what I did so far: Project> Properties> java build path > libraries> add jars ( also tried adding external jars), but it always showed my new jar file independantly, i want it to be a part of android dependancies). any clue? Here's a screen shot, I would like to add it as a part of android dependencies:

回答1:

I still do not get why that is important to you.

However, when you reference a library project: rightclick project->properties->Android->Add then the jar goes into Android Dependencies.

If you add the jar directly to your project under libs or using build path, then it goes under Android Private Libraries.

Both methods works but referencing a library project can have benefits if you want to alter the code of the library during development.



回答2:

In my case I had the following in my project.properties file

target=android-18
proguard.config=proguard.cfg
android.library=false
android.library.reference.1=..\\com_facebook_android

android.library.reference.2=../actionbarsherlock

After I changed the last line to

android.library.reference.2=..\\actionbarsherlock

actionbarsherlock.jar appeared in the Android Dependancies and I could run my app without the java.lang.noclassdeffounderror exception