Aybak3k
Aybak3k

Reputation: 326

Flutter can't recognize android sdk

I'm running Ubuntu 20 and trying to setup flutter enironment without android studio. Installed android sdk manually && it's path is $HOME/android.

here's a log of the directory

$ ls
# cmdline-tools  licenses
$ ls cmdline-tools/
# latest  tools
ls cmdline-tools/latest
bin  lib  NOTICE.txt  package.xml  source.properties

And here's sys vars which are in ~/.bashrc

export ANDROID_SDK_ROOT="$HOME/android"
export ANDROID_HOME="$ANDROID_SDK_ROOT"
export PATH="$PATH:$ANDROID_SDK_ROOT"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools/platform-tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/build-tools"

And here's flutter doctor - v log

[!] Android toolchain - develop for Android devices
    • Android SDK at /home/aybak3k/android/
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

    • ANDROID_HOME = /home/aybak3k/android/
    • ANDROID_SDK_ROOT = /home/aybak3k/android
    ✗ Android SDK file not found: adb.
    • Try re-installing or updating your Android SDK,
      visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.

Upvotes: 0

Views: 128

Answers (2)

Aybak3k
Aybak3k

Reputation: 326

flutter can't recognize the sdk unless you install the rest of the components

the following worked

# 30 is my physical device compatible version
sdkmanager --install "build-tools;30.0.2"
sdkmanager --install "platforms;android-30"

Upvotes: 0

Emanuel Braz
Emanuel Braz

Reputation: 384

Probably because is missing /sdk

Try to change export ANDROID_SDK_ROOT="$HOME/android"

to export ANDROID_SDK_ROOT="$HOME/android/sdk"

if not work, try to check the full path to platform-tools

run which adb

$HOME/android/sdk/platform-tools/adb

Upvotes: 1

Related Questions