1

I have a library beside my main project in an android project. How can I set compiler to it always compile library first and then compiles my main code? Currently I have to compile two times on every build.

AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
  • Have you set the main project to be dependent on the library? Do you have automatic build on? If you have, then Eclipse should take care of the builds automatically. – Ted Hopp Nov 07 '13 at 06:32

1 Answers1

3

To Add Library project to Your Project

1.If you have a jar file then place the jar file in the libs folder in your project. then right click on it and Build Path-->Add to Build Path

2.If you have a library as a project then right click on your Main project Properties-->Android-->Add then select your library project(make sure here library projects with librariesonly appear)

3.if your library project is not appearing in this list then rigth click on your library project Properties-->Android tick isLibrary option there)

you can cjheck out the image like..

enter image description here

if you want to change the priority of your Library

Right Click on your Project Build path--> Configure Build path --> Order and Export

there you will see your library select your library click on top at the right side

the image is like below.

enter image description here

kalyan pvs
  • 14,486
  • 4
  • 41
  • 59
  • And what are check boxes beside each library? – AVEbrahimi Nov 07 '13 at 06:35
  • I did this, now it doesn't say the apk build before, but still I have two compile two times to have my changes apply to app on mobile. – AVEbrahimi Nov 07 '13 at 06:37
  • And it prompts this : Dx trouble writing output: already prepared – AVEbrahimi Nov 07 '13 at 06:38
  • ones check this link..http://stackoverflow.com/questions/6146655/compiling-jars-and-add-them-to-android-project – kalyan pvs Nov 07 '13 at 06:40
  • i am using 19.0.3 build tools, and compiling with 4.4. I was getting same error Dx trouble writing, but after moving android private lib folder on top it started working. Thanks!!! – parul Mar 18 '14 at 17:52