Steven, got it working!
I suspect that the auskey install must have dumped a whole lot of junk jar files (some dating back to 2006) into /Library/Java/Extensions. If I move these aside, maven works on the command line and I can finally build apps with Android Studio.
My /Library/Java/Extensions directory contained the following jar files:
Andrews-MacBook-Air:Extensions andrew$ pwd /Library/Java/Extensions Andrews-MacBook-Air:Extensions andrew$ ls -l
-rwxr-xr-x 1 root
admin
368759 31 Aug 2011 DBusJava.jar -rwxrwxrwx 1 andrew staff
233527 14 Aug 2012 KeyStoreBE.jar -rw-r–r-- 1 andrew staff
112185 21 Feb 2006 RXTXcomm.jar -rwxrwxrwx 1 andrew staff
62983 14 Aug 2012 activation.jar -rwxrwxrwx 1 andrew staff
220733 14 Aug 2012 bcmail-jdk15-143.jar -rwxrwxrwx 1 andrew staff
103515 14 Aug 2012 jaxb-api.jar -rwxrwxrwx 1 andrew staff
866992 14 Aug 2012 jaxb-impl.jar -rwxrwxrwx 1 andrew staff
46047 14 Aug 2012 jsr173_1.0_api.jar -rwxr-xr-x 1 andrew staff
326432 21 Feb 2006 librxtxSerial.jnilib -rwxrwxrwx 1 andrew staff
434812 14 Aug 2012 mail.jar -rwxrwxrwx 1 andrew staff 7056159 14 Aug 2012 tools.jar
Removing tools.jar and bcmail-jdk15-143.jar fixed my problem, although I’m tempted to get rid of the lot as I can’t see them doing any good.
Thanks for your help, and I hope the same solution works for you.