Android Studio Won't Use Brew Cask Android-SDK Directory

Viewed 2732

We try to maintain scripts to rapidly onboard new developers and maintain consistency across teams/members. We used to install the Android SDK and NDK tools via command line as part of our scripts, download all the platforms we need and tools, and then setup android studio to use them. Since the release of Android 26 this doesn't seem possible and Android wants it to all be done via Studio. Is there any reason why the below scenario would not work?

Mac OSX Android Studio: 2.3.3 - Installed via brew cask install android-studio (Homebrew)

Android-SDK 26: Installed via brew cask install android-sdk

Android rc file (sourced in bash_profile)

export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export ANDROID_HOME=/usr/local/share/android-sdk/
export ANDROID_NDK_HOME=/usr/local/share/android-ndk

Steps to reproduce:

  1. Install above dependencies using homebrew cask.
  2. Update environment variables (export them in bash profile or the like).
  3. Open android studio - It should prompt to install the SDK.
  4. Attempt to use the share sdk (android sdk root path above).
  5. Android Studio says sdks is not valid nor empty.
3 Answers

For osx and the new Android Studio (2.3.3 at this time) the sdk is now in ~/Library/Android/platforms and the tools are in ~/Library/Android/platform-tools so add those to our path instead of using brew.

Related