Fixes for Issue 360

Manfred I have keep all the commit so that it can more readily be reviewed step at a time, but give the word and I will squash it into a single commit.

This branch doesn't attempt to resolve the larger issues in #380. Eg NDK libraries are still constructed in ${basedir}/obj/local