Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

Android: What is the folder name of the jar files (LIB or LIBS)?

I am going to create a library project which has several dependencies (jar files). I am confused because I've seen some android projects which has LIB or LIBS folder under project root folder (together with bin,gen,res,src.etc..)

Even I add LIB or LIBS folder, then put the jar files on it. Still need to set the project properties in order to recognize the added jar files by doing Project Properties => Java Build Path => Libraries tab => Add JARs... button.

I am using Eclipse with Android Plugin. When I add LIBS, it will appear the Android logo on the top of the LIBS folder. It is recognized by the plugin but still need to set it in the project properties (same the above adding JARs)

Which is the correct directory structure for Android Project?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you use the Android command line to create your project, it'll default to libs/. It turns out that the Android Ant tasks are set to look in libs/ by default.

See $ANDROID_HOME/tools/ant/main_rules.xml:

<property name="jar.libs.dir" value="libs" />

If you just care about Eclipse, you can use whatever you want.

In newer revisions of ADT (revision 17 onwards), the Ant-based build system and the Eclipse plug-in are aligned so that they behave the same way. This means, by default, only the jars that are present in the libs folder are included in the final apk file. These jars would automatically appear under "Android Dependencies" in your Eclipse project.

For more details please refer here. http://tools.android.com/recent/dealingwithdependenciesinandroidprojects


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...