'Flutter Doctor not recognizing my ANDROID_SDK environment variables
I have the android-sdk installed from ubuntu's repository but it does not contain the sdkmanager executable and isn't current enough to be compatible with flutter, so I installed the wrapper from snapd that contains it. According to the documentation I have to change my ANDROID_SDK_ROOT env. variable so that it works with it. I have also read that I need to set ANDROID_HOME to the directory (I think it's deprecated but just in case) so I put this in my .profile:
export ANDROID_SDK_ROOT=/snap/androidsdk/current/
export ANDROID_HOME=/snap/androidsdk/current/
I then ran source .profile and restarted my machine, however flutter doctor kept giving me this error:
[!] Android toolchain - develop for Android devices (Android SDK version 27.0.1)
✗ Flutter requires Android SDK 29 and the Android BuildTools 28.0.3
To update the Android SDK visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.
I know that it's using the wrong path because when I run flutter doctor --android-licenses I receive this error:
Android sdkmanager tool not found (/usr/lib/android-sdk/tools/bin/sdkmanager).
Which points to the path of the the SDK I installed with apt. I have tried flutter config --android-sdk $PATH_TO_SDK but that still has not changed anything. Is there a ppa that contains the sdk manager so that I don't have to try and configure flutter to use the snapd androidsdk or is there something I'm missing/doing wrong?
OS: Ubuntu 20.04
androidsdk (snapd) version: 30 (I would prefer not to use this)
android-sdk (apt) version: 25.0.0 (Which is also below flutter's requirements)
Solution 1:[1]
The solution that worked best for me was to:
Install android-studio with
snap install android-studio --classic,Create an
Androidfolder in my home directory and install all the needed components into that folder using android studio and then uninstall android-studio.run
flutter config --android-sdk ~/AndroidThis configures flutter to use the newly installed Android-sdk located in the home directory.
The advantage of this is that I was able to install the emulator and sdk withut needing to configure anything. The disadvantage is that I'm not sure how the updating process will go, I would have prefered to have used a package manager but this is the easiest way that I have figured out.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | joshpetit |
