9
brew cask install android-sdk

Warning: A Cask for android-sdk is already installed.

brew cask reinstall android-sdk

or

brew cask uninstall android-sdk
==> Caveats We will install android-sdk-tools, platform-tools, and build-tools for you. You can control android sdk packages via the
sdkmanager command. You may want to add to your profile:   'export
ANDROID_HOME=/usr/local/share/android-sdk'

This operation may take up to 10 minutes depending on your internet
connection. Please, be patient.

==> Downloading https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
Already downloaded:
/Users/ishandutta2007/Library/Caches/Homebrew/Cask/android-sdk--25.2.3.zip
==> Verifying checksum for Cask android-sdk Error: No such file or directory - /usr/local/share/android-sdk Follow the instructions here:
https://github.com/caskroom/homebrew-cask#reporting-bugs
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1439:in
`unlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1439:in
`block in remove_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1444:in
`platform_support'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1438:in
`remove_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:785:in
`remove_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:563:in
`block in rm'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:562:in
`each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:562:in
`rm'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in
`block (2 levels) in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:35:in
`instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:35:in
`block in abstract_phase'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in
`each_key'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in
`each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:34:in
`abstract_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:28:in
`uninstall_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:330:in
`block in uninstall_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:327:in
`each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:327:in
`uninstall_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:312:in
`uninstall'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb:27:in
`block in install_casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb:6:in
`each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb:6:in
`install_casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:10:in
`run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in
`run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in
`process' /usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `<main>'

Tried this but no luck, and I have not deleted anything like mentioned in this question.

aSemy
  • 5,485
  • 2
  • 25
  • 51
ishandutta2007
  • 16,676
  • 16
  • 93
  • 129
  • I got my issue sorted by installing via AndroidStudio and then setting ANDROID_HOME and PATH variable as mentioned here http://stackoverflow.com/a/19986294/865220, but the question should remain open as I couldn't get it working using homebrew – ishandutta2007 Apr 16 '17 at 05:13
  • [brew](https://formulae.brew.sh/cask/android-sdk) recommends tu use `brew install --cask android-sdk` – Pavol Travnik Apr 07 '21 at 12:07

3 Answers3

11

I observed no such directory /usr/local/share/android-sdk as the error stated:

$ sudo find /usr -name "android-sdk"
/usr/local/Caskroom/android-sdk

I also ran into these errors:

Error: It seems there is already a Binary at '/usr/local/bin/adb'; not linking.
Error: It seems there is already a Binary at '/usr/local/bin/fastboot'; not linking.

I deleted the mentioned files and then was able to install:

$ rm -rf /usr/local/Caskroom/android-sdk
$ rm -rf /usr/local/bin/adb
$ rm -rf /usr/local/bin/fastboot
$ brew cask install android-sdk
Charlie Gorichanaz
  • 1,144
  • 1
  • 9
  • 20
1

If you want to install that package cleanly, you'll have to remove the broken stuff previously

brew doctor
brew cleanup

then you can proceed installing the package.

Manually removing binaries is not recommended, homebrew already does that for you and it knows exactly what to remove.

Daniel Andrei Mincă
  • 4,446
  • 2
  • 19
  • 30
0

I had a very similar issue after the recent relocation of android-sdk into caskroom/cask managed to break one of my install scripts. I ended up fixing it by manually messing around directly with the cask-installed directories (/usr/local/share/android-sdk, /usr/local/opt/android-sdk, and so on). I either deleted what was there or created empty directories, then re-running the remove/reinstall/delete commands finally worked. Sorry I can't be more specific, but it was basically a case of getting my directories to look like brew expected them to look.

Endareth
  • 492
  • 3
  • 15