SVN, Android Pre Compiler and Mac OS X = PITA combination
As far as I’m concerned SVN is a thing of the past. In todays market of SCMs my weapon of choice is git and I’m very satisfied ever since I made that transition. That was easy enough for me, a freelance developer, but may not be so easy for a company for reasons both real and imaginary. That’s why I still have to use SVN for time to time whenever I’m consulting for a company with SVN repositories.
Installing SVN on Mac is as easy as it should be but not so straightforward. The first way you’ll run in doing a google search is to install CLI tools form XCode IDE for Objective C. Not very intuitive but it did the trick. I’ve noticed that this installs an older 1.6.x version but at the time I didn’t gave this fact a lot of thought.
From the beginig of development on my latest android project I kept getting this really strange error in Eclipse:
Errors occurred during the build.
Errors running builder ‘Android Pre Compiler’ on project ‘XXX’.
As you see, the message is very descriptive and it gives you a clear path to solution, right? Well, not so much…
After some googling it became clear who’s to blame. The android team made a change in Android SDK tools to throw an error if you have a file in your project with no extension sufix in the file name. (i.e. image instead of image.png). I don’t se why would they do this and if there’s a reason if it is good enough to break backward compatability. But it is what it is. Some stackoverflowers claimed that this will be changed back in next release and that you could even download preview version of the next realese and this will make your problems go away. To do so you need to enable android SDK manager to show you preview realeses and then to install it. At first this worked for me but only for a day and the same problem was back.
Lets get back to SVNs role in all this. It seems that some of SVNs files makes Android Pre Compiler crash on build. Again, someone claimed that this is only issue with SVN 1.6.x and that it doesn’t exists in SVN 1.7.x. I’ve decided to give this a try. Installing SVN 1.7.x is not as easy as a piece of cake — after all it’s including configuring and make-ing software from the terminal but if you are a developer you should find your way through this obviously. Unfortunately the most forward way of this instalation, such as depicted on this blog, is not going to work with https URLs for your repositories. To make it work you will have to compile and install Neon and then compile SVN with an apropriate switch. This is the gist of it (some of it in pseudo commands):
// download and install Neon HTTP client library
sudo make install
// download and install subversion
./configure --prefix=/usr/local --with-ssl --with-neon=/usr/local
sudo make install
// configure your PATH to target the newly installed SVN if you have another version
After this everything is working, so I can return to actuall coding at list until another android PITA (pain in the ass, in case you’re wondering : )