15

I have installed Android Studio in the F:\ drive. My Flutter project is in the E:\ drive.

The Flutter plugin is installed in the Android Studio. But when I open my project in Android Studio and I go to the SDK Manager, it shows the following error:

The android sdk location cannot be at the filesystem root

Every package is disabled and the checkboxes are disabled, so I cannot click them to install Android SDK. The "Edit" link next to the error is not working either.

enter image description here

Drarig29
  • 1,902
  • 1
  • 19
  • 42
Ayan
  • 165
  • 1
  • 1
  • 9

15 Answers15

8

Just press Edit ( It is clickable) then download and install the required components.

  • 2
    The Edit link is not working. I tried that many times. But cannot understand why. – Ayan Jun 24 '21 at 10:00
  • I got the edit button to work by running android-studio/bin/studio.sh manually, when I got the error message that: Incomplete or corrupted installation - "/Users/me/app/prebuilts/studio/jdk/jdk11/mac/Contents/Home" directory does not exists. I created it by running mkdir -p /Users/me/app/prebuilts/studio/jdk/jdk11/mac/Contents/Home and got Edit button to work. – PHZ.fi-Pharazon Jul 04 '23 at 12:53
5

Using the new android studio (bumble bee version) . Restart the app and make sure you have an internet access That will be enough to create the SDK and it’s directories

Airick
  • 51
  • 1
  • 1
2

I came with the same problem because of forgetting "sudo"

2

I searched for many hours for an answer to this I reinstalled:

  1. I opened a new folder called Android in C:
  2. Into it I reinstalled the android studio
  3. You have created a new SDK folder within it Then in the blank path, I entered C: \ Android \ sdk And that's how it all worked. Try it!
Jaydeep parmar
  • 561
  • 2
  • 15
1

Download the SDK first, and restore the default settings.

You can find the "Restore default settings" feature here.

Drarig29
  • 1,902
  • 1
  • 19
  • 42
  • From where I can download the sdk separately? When I am going to download sdk it tells me to download the Android Studio every time. – Ayan Jul 27 '21 at 06:41
  • I have downloaded platform-tools from https://android-sdk.en.softonic.com/. Added the path in Environment variables. And selected Restore Default Settings in Android Studio. But the android sdk is still not working. Still every package is disabled and the checkboxes are disabled. Where am I doing wrong? – Ayan Jul 27 '21 at 07:36
  • I have managed to install SDK version 31.0.2 but flutter 2.2.3 requires version 30. Cannot find version 30 from anywhere. Can you help please? – Ayan Jul 30 '21 at 15:27
1

What you can do is that you click on edit to surely you will get some version of Android that installs it by default and you click on next it will open another configuration verification window and you click on the next one for last it will tell you or It will update the version of android that was downloaded by default and you click again to finish and you can just select other versions of Android. That worked for me. Linux Ubuntu 20.04.4 LTS

Step 1:

Step 2:

Step 3:

Step 4:

Ready!!

Majid Roustaei
  • 1,556
  • 1
  • 20
  • 39
1

For me it was the system language on Windows, I have changed it to English and it worked.

Omar Hatem
  • 11
  • 1
1

TL; DR

Make sure:

  • Your user has write permission into Android SDK directory.
  • ANDROID_HOME is correctly defined with the correct SDK location.

Description

IMHO it is a really bad practice install SDK into user home directory because:

  • Packages added will be restricted to a single user.
  • System administrators won't be able to mirror OS images, thus each engineer will have to install SDK manually.

The old school way is according to Linux directory hierarchy as described at The Linux Documentation Project, which consists on:

  1. Ensure your user has adm privileges
  2. Export SDK environment variables
  3. Obey the filesystem hierarchy, installing the IDE and SDK into /opt

The steps above work perfectly on Ubuntu 22.04 and shall work on other distros with minor adjustments.

1. Ensure your user has adm privileges

grep adm /etc/group | grep ${USER}
adm:x:4:syslog,ventura
lpadmin:x:122:ventura

2. Configure environment variables

/etc/profile.d/
├── ...
├── android.sh
├── ...
├── java.sh
└── ...

where android.sh contains

#!/usr/bin/env bash


export ANDROID_HOME=/opt/google/android/
export FLUTTER_HOME=${ANDROID_HOME}/flutter

TOOLS=${ANDROID_HOME}/platform-tools
TOOLS=${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/tools:${TOOLS}

export PATH=${FLUTTER_HOME}/bin:${TOOLS}:${PATH}

and java.sh your JRE directory

#!/usr/bin/env bash


export JAVA_HOME=/usr/lib/jvm/java-18-openjdk-amd64

3. Install Android Studio and Android SDK

Download latest Android Studio and unpack it into /opt/jetbrains/:

VERSION=2021.2.1.16

sudo mkdir -p /opt/google/android
sudo mkdir -p /opt/jetbrains/studio

# Unpack Android Studio into a versioned folder
tar -xvzf android-studio-${VERSION}-linux.tar.gz
sudo mv android-studio /opt/jetbrains/studio/${VERSION}

# Grant write permission to administrators
sudo chown root:adm -R /opt/jetbrains/
sudo chmod g+w -R /opt/jetbrains/

sudo chown root:adm -R /opt/google/android
sudo chmod g+w -R /opt/google/android

Finally launch Android Studio and choose the SDK location:

android-studio-img

This approach is extremely powerful because it allows system administrators duplicate development workstations using rsync -avz without relying onto any username or custom privileges.

JP Ventura
  • 5,564
  • 6
  • 52
  • 69
0

You can clear invalidate caches and restart android studio like follow picture:

enter image description here

Then start download sdk files :)

Ehsan Kalali
  • 411
  • 6
  • 16
  • 1
    Tried many times, but no luck. Can't understand why package checkboxes are disabled. – Ayan Aug 24 '21 at 12:07
  • I have tried this also in WSL package. SDK Manager says at edit stage, an automatic version of sdk has been found, but once in preferences > sdk manager trying to enable some android version - the option checkboxes are greyeed out and disabled. The preferences has a blank textbox saying the 'not at filesys root' message – mschr Jan 11 '22 at 22:24
0

Make sure that your internet is working and try to close VPN connections if you have any. Then restart Android Studio and hope for the best.

Christian C
  • 369
  • 3
  • 10
0

To solve this issue, I had to close Android studio entirely. When I started the application again, it detected that it had a missing SDK problem and then went ahead with the installation process for it.

0
  1. Your country should not be among the sanctioned countries (using VPN).
  2. Android Studio by Run as Administrator open.
  3. Download : Android SDK and Android SDK Platform.
  4. Fix error: the android sdk location cannot be at the filesystem root.

For test The VPN is working properly. Open website : https://developer.android.com/

0

this is the best solution to this error which is just under any drive you have on your laptop which C:// open a folder called "Android" and under the android folder open a folder called "sdk" and change the sdk file path to this recently created folder. That's All.

0

I had the same problem and I resolving it doing this:

  1. Found a folder in the C:\ path called "Android" and then deleted it
  2. After I did that, I open Android Studio and did the following:

file -> Appearance & Behaviour -> System Settings -> Android sdk -> clicked the edit button -> clicked next

and it worked.

Hope this might help

Il_77enne
  • 48
  • 7
0

I came across this very problem a couple of minutes ago. What worked for me is simply closing Android Studio then opening it up again, pre-connected to the internet. It will allow you to download the SDK platform, which it didn't download with the SDK tools.