Home » Android » macos – "The selected directory is not a valid home for Android SDK" IntelliJ 2017

macos – "The selected directory is not a valid home for Android SDK" IntelliJ 2017

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am trying to perform a clean installation of the latest Android SDK and IntelliJ 2017 CE.

I have done things in this order:

  1. Install IntelliJ 2017 CE
  2. Install JDK 1.8.x
  3. Install Android SDK using latest homebrew instructions
  4. Set JDK location in IntelliJ
  5. Attempt to set Android SDK location in IntelliJ.

The last step gives me the error mentioned in the title. The SDK is located at /usr/local/share/android-sdk which is a symlink to /usr/local/Caskroom/android-sdk/3859397. This SDK folder contains these files:

enter image description here

I have searched extensively for a solution, including other questions on SO. Here is a rough list of things I have tried:

  • chowned the SDK folder (and symlink) as my local user and also as root
  • Ran IntelliJ as root and tried to add Android SDK
  • Tried adding both the symlink and destination directory as the SDK directory
  • Reinstalling android-sdk via homebrew multiple times, restarting IntelliJ, restarting my computer

Even though there are seemingly identical questions here on SO, none of them seem to address my situation (2017 Android SDK and IntelliJ, Mac OS).

I would like to avoid giving up on the homebrew Android SDK installation, and resorting to a manual SDK installation, as it seems like it would just give me the exact same files, placed in a different location. I would also like to avoid installing Android Studio in parallel with my IntelliJ installation (kind of like using a sledgehammer to solve the problem).

Thank you for any help. I am not trying to do anything fancy – I just want a basic setup for developing Android apps using IntelliJ.

How to&Answers:

IntelliJ Idea can’t detect the Android-SDK because there is no “Platforms” folder

It can be created by running below commands

List installed and available packages :
sdkmanager –list

Install packages :
sdkmanager “platforms;android-26”

Then reference the “/usr/local/Caskroom/android-sdk/3859397” it will work

Reference link : https://developer.android.com/studio/command-line/sdkmanager.html

Answer:

I have found this article helpful.
https://www.soupwaylee.com/2017/09/02/android-setup.html

At this point you can add the Android SDK to your platform settings in IntelliJ. Before that, you need to create the “Platforms” folder, otherwise IntelliJ can’t detect the Android SDK and will throw “The selected directory is not a valid home for Android SDK” error message.
and install it by running
$ sdkmanager “platforms;android-“