Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 322
Aralox Avatar asked Jun 30 '17 06:06

Aralox


People also ask

How do I fix the SDK emulator directory is missing?

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.

Do I need to install IntelliJ if I have Android Studio?

If I'm already a user of IntelliJ IDEA, do I need to switch to Android Studio for Android development? No. Android Studio is focused specifically on Android development and provides streamlined environment and project setup, but otherwise all of its features are available in IntelliJ IDEA.

Where is Android SDK installed?

by default, the "Android Studio IDE" will be installed in " C:\Program Files\Android\Android Studio ", and the "Android SDK" in " c:\Users\username\AppData\Local\Android\Sdk ".


1 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

like image 146
Vigneshwaran Rajan Avatar answered Sep 19 '22 13:09

Vigneshwaran Rajan