Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 667
JTT Avatar asked Jul 10 '17 17:07

JTT


People also ask

How do I fix Android SDK not found?

The Cause for this error -SDK tools package might not be installed. Quick fix: Go to the Tools –> SDK manager –> SDK tools. Deselect Hide obsolete packages option on the right bottom and further install Android SDK Tools(obsolete). A new folder named Tools is now generated in the SDK directory.

Where is brew Android SDK installed?

You can also choose to install Android SDK using Homebrew (the brew install android-sdk command). This installs the Android SDK in the /usr/local/Cellar/android-sdk/{YOUR_SDK_VERSION_NUMBER} path, so ANDROID_HOME should point to the installed location.

Where is Sdkmanager installed?

The sdkmanager tool is provided in the Android SDK Command-Line Tools package.


1 Answers

Try running sdkmanager "platforms;android-26". This is because the basic tools are not installed to be recognised as a valid SDK directory.

like image 63
Nicholas Avatar answered Oct 13 '22 01:10

Nicholas