I had a similar problem this morning (trying to build for Android using Unity3D). I ended up uninstalling JDK9 and installing Java SE Development Kit 8u144. Hope this helps.
brew cask uninstall java# uninstall java9brew tap homebrew/cask-versionsbrew cask install java8# install java8touch ~/.android/repositories.cfg# without this file, error will occur on next stepbrew install --cask android-sdk