assuming you are already installed flutter and jdk 8.
first download command line tools
download the Command line tools only.
link:
https://developer.android.com/studio/index.html#downloads
cd into your home directory and create folder android_sdk/cmdline-tools
.
extract the downloaded command line tools into the newly created folder cmdline-tools
.
then rename the extracted folder to latest
.
now it should be something like this:
$ ls $HOME/android_sdk/cmdline-tools/latest
bin lib NOTICE.txt source.properties
add this to .bashrc
file, or whatever shell you are using
export ANDROID_SDK_ROOT=$HOME/android_sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin
# prepared
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
then, restart your terminal if it is running. or start a new terminal if not.
run the following command:
sdkmanager "platforms;android-30"
sdkmanager "patcher;v4"
sdkmanager "tools"
sdkmanager "build-tools;29.0.2"
sdkmanager --update
it will download some big files, just wait until it complete.
then run this command:
flutter config --android-sdk $ANDROID_SDK_ROOT
flutter doctor --android-licenses
it will ask something (y/n)
, just y
all.
now try running your flutter app. good luck
if you are using scrcpy, and it doesn't work properly when running flutter,
make sure the adb version you are using is the same as the one in android sdk.
to fix it, copy the adb binary located in $ANDROID_SDK_ROOT/platform-tools
(used by flutter) to /usr/bin
(used by scrcpy).
for example:
sudo cp $ANDROID_SDK_ROOT/platform-tools/adb /usr/bin
- https://stackoverflow.com/questions/37505709/how-do-i-download-the-android-sdk-without-downloading-android-studio
- https://stackoverflow.com/questions/60440509/android-command-line-tools-sdkmanager-always-shows-warning-could-not-create-se
- https://stackoverflow.com/questions/49175231/flutter-does-not-find-android-sdk
- https://stackoverflow.com/questions/59476081/flutter-error-could-not-determine-the-dependencies-of-task-appcompiledebugjav
- Genymobile/scrcpy#992