简体   繁体   中英

Referencing a library project in Android

If I decided to use a library project in mine I still have to keep this library project in my workspace. Is there a way to avoid this? Also, does it mean I have to deliver an addition folder of library project with a folder of mine?

Library projects works like a charm, but of course you need to keep them open in the workspace as everytime eclipse builds your project it needs to access all the stuff from the library project.

If you don't want to keep this project open AND you don't plan to change it a lot AND it's not an Android project, it's a JAVA commom project you can build it once and instead of using a library project reference a JAR in your android project

If you want to do this outside of Eclipse, (say you're building from the terminal with ant, ie. in continuous integration, or if you just hate Eclipse.) Just place the library project in an adjacent directory. In your main project, edit project.properties to include:

android.library.reference.1=../LibraryFolderName

If you have more than one library to add, just number them accordingly, ie.

android.library.reference.1=../LibraryFolderName
android.library.reference.2=../AnotherLibraryFolderName

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM