views:

178

answers:

2

Hello all,

I have a legacy application and need to split it into a library project (common code) and two application projects (paid and free applications). I don't use Eclipse for development, and also don't use Ant builds provided (generated) by Android SDK (there are several reasons for that: different project directory structure, unit tests integrated into the build, integration with CruiseControl, automatic builds numbering etc), but use our custom build files instead.

I need to modify my Ant builds to make them build my applications projects that refer my library project. I looked into sample application and Ant builds shipped with SDK, but didn't understand how it is done. I saw that library project contains "libs" directory and "default.properties" file with "android.library" property set to "true". I saw that applications project contains "default.properties" file with "android.library.reference.X" property set to library project directory value. But I didn't find any reference to these properties in the Ant builds (project Ant build file, and Ant builds shipped with SDK). Just placing these files into application/library project directories doesn't help, i.e. SDK tools doesn't interpret them.

My guess is that this is performed by com.android.ant.SetupTask, but I'd like to know how it is performed. My build is set of targets that call (using exec) Android SDK tools: appt, dx, apkbuilder and so on. So I'd like to know which command line parameters I need to use to make, lets say, appt tool to merge resources?

Thank you in advance.

A: 

Hi,

I recently wrote ant build script for my one of android product that make use of another android framework as library. The trick I used was to copy src,resource and assets of library project into the main project and then use ant android task to build the apk package. The trick works perfectly for me.

Let me know if you still need some help.

Imam Raza
A: 

Integrate drive:[path to android sdk]\tools\ant\ant_rules_r3.xml to your build.xml. It should take care of the copying of the library files and generate the build properly.