Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Android app from ant via Hudson - chicken and egg problem

When using an Android-generated ant build file, the file references your SDK installation via an sdk.dir property inside the local.properties files which is generated by "android update project -p .".

The comments in build.xml suggest that local.properties should NOT be checked into version control.

BUT, when you run your build from Hudson, it does a fresh checkout of your code from version control, hence local.properties does not exist and subsequently the build fails without sdk.dir being set. So its kind of chicken and egg problem. As a workaround I have checked local.properties into version control for now (nobody else will use it) but I was curious as to how other developers had tackled this problem ?

like image 426
Eno Avatar asked Dec 17 '22 01:12

Eno


2 Answers

Just add a first "Execute Shell" step to your build job that runs "android update project -p ." - this will be run immediately after the source is checked out. Put your Ant build step after that and you should be OK.

like image 84
gareth_bowles Avatar answered Dec 21 '22 09:12

gareth_bowles


You could just pass -Dsdk.dir=/some/where/android-sdk-linux to the ant command line in hudson.

like image 43
Dominic Mitchell Avatar answered Dec 21 '22 09:12

Dominic Mitchell