For anyone on Linux, I've wrote a script to download and setup the android SDK and flutter.
I was getting errors with flutter doctor being unable to find the sdkmanager and cmdline-tools and this fixed it.
Let's see how long until they make a change to break this script lol.
See the github repo for possible updates to this :).
https://github.com/sslater11/flutter-linux-installer-with-android-studio/
#!/bin/bash
# This script is licensed under the BSD 3-Clause License.
android_backup_path=`mktemp -u -t Android.backup.XXXXXXX -p "$HOME/"`
flutter_backup_path=`mktemp -u -t flutter.backup.XXXXXXX -p "$HOME/"`
message_download_android_studio="Before running this, please download android studio ladybug from here\nhttps://developer.android.com/studio\nAnd then extract it to $HOME/android-studio-ladybug/\n\nPress enter when done and the script will setup flutter for android development"
whiptail --title "Information" --msgbox "$message_download_android_studio" 0 0
whiptail --title "Information" --msgbox "You will be asked to accept loads of licenses and it's all google's fault..." 0 0
if whiptail --title "Confirmation" --yesno "Warning: You are about to move files.\nBacking up old android($HOME/Android) to $android_backup_path\nDo you want to continue?" 0 0; then
echo "User chose to continue."
else
echo "User chose to cancel."
exit
fi
echo "Backing up old android($HOME/Android) to $android_backup_path"
mv "$HOME/Android" "$android_backup_path"
echo "Creating new folder $HOME/Android"
mkdir -p "$HOME/Android/Sdk/"
cd "$HOME/Android/Sdk/"
echo "Downloading commandlinetools and extracting."
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
# Create the cmdline-tools folder
# and also make a folder called 'latest' inside cmdline-tools, which is the exact same as cmdline-tools
unzip commandlinetools-linux-11076708_latest.zip
mkdir cmdline-tools/latest
unzip commandlinetools-linux-11076708_latest.zip -d cmdline-tools/latest
mv cmdline-tools/latest/cmdline-tools/* cmdline-tools/latest/
rm -rf cmdline-tools/latest/cmdline-tools/
cd cmdline-tools/bin
./sdkmanager --sdk_root="$HOME/Android/Sdk/" --install "build-tools;36.0.0-rc3"
./sdkmanager --sdk_root="$HOME/Android/Sdk/" --install "platforms;android-35"
./sdkmanager --sdk_root="$HOME/Android/Sdk/" --install "platform-tools"
./sdkmanager --sdk_root="$HOME/Android/Sdk/" --install "emulator"
./sdkmanager --sdk_root="$HOME/Android/Sdk/" --install "cmdline-tools;latest"
./sdkmanager --sdk_root="$HOME/Android/Sdk/" --licenses # Ask user to accept all licenses
cd ../../
if whiptail --title "Confirmation" --yesno "Warning: You are about to move files.\nBacking up old flutter($HOME/flutter) to $flutter_backup_path\nDo you want to continue?" 0 0; then
echo "User chose to continue."
else
echo "User chose to cancel."
exit
fi
echo "Downloading flutter"
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.27.1-stable.tar.xz
echo
echo "Backing up old flutter($HOME/flutter) to $flutter_backup_path"
mv "$HOME/flutter" "$flutter_backup_path"
tar -v -x -f "flutter_linux_3.27.1-stable.tar.xz"
mv "flutter" "$HOME/"
cd "$HOME/flutter/bin"
echo
echo If this freezes, press enter. It should take less than a second.
./flutter --disable-analytics
echo If this freezes, press enter. It should take less than a second.
./dart --disable-analytics
echo If this freezes, press enter. It should take less than a second.
./flutter config --android-sdk="$HOME/Android/Sdk"
./flutter config --android-studio-dir="$HOME/android-studio-ladybug/"
echo
echo
echo "--------------------"
if whiptail --title "Confirmation" --yesno "Would you like to add flutter to your \$PATH variable?\nThis will be appended to your ~/.bash_profile\nYou will need to log out and back in for changes to take place.\nAfterwards you can use the 'flutter' command in a bash shell." 0 0; then
echo "User chose to continue."
echo 'export PATH="$HOME/flutter/bin:$PATH"' >> ~/.bash_profile
if [ -e "/usr/bin/chromium" ]; then
echo 'export CHROME_EXECUTABLE="/usr/bin/chromium"' >> ~/.bash_profile
elif [ -e "/snap/bin/chromium" ]; then
echo 'export CHROME_EXECUTABLE="/snap/bin/chromium"' >> ~/.bash_profile
fi
fish_add_path "$HOME/flutter/bin/"
else
echo "Please add flutter to your \$PATH variable to make it executable using the 'flutter' command."
echo "For bash shell type this command to add it to your bash path permanently."
echo "echo 'export PATH=\"\$HOME/flutter/bin:\$PATH\"' >> ~/.bash_profile"
echo
echo "or to add it for just this bash session"
echo 'export PATH="$HOME/flutter/bin:$PATH"'
echo
echo "For fish shell, type this command"
echo "fish_add_path \"\$HOME/flutter/bin/\""
if [ -e "/usr/bin/chromium" ]; then
echo
echo "Set the location for chromium for web develoment."
echo "echo 'export CHROME_EXECUTABLE=\"/usr/bin/chromium\"' >> ~/.bash_profile"
echo "or"
echo "export CHROME_EXECUTABLE=\"/usr/bin/chromium\""
elif [ -e "/snap/bin/chromium" ]; then
echo
echo "Set the location for chromium for web develoment."
echo "echo 'export CHROME_EXECUTABLE=\"/snap/bin/chromium\"' >> ~/.bash_profile"
echo "or"
echo "export CHROME_EXECUTABLE=\"/snap/bin/chromium\""
fi
fi
echo "Finally run in a terminal the command"
echo "flutter doctor"
echo "or"
echo "$HOME/flutter/bin/flutter doctor"
echo
echo "for a more detailed output run"
echo "$HOME/flutter/bin/flutter doctor -v"
echo
echo "If it didn't work, you may need to logout and back in for changes to take effect."
echo "A quick way to test if you need to login/out is to run theese commands:"
echo "bash --login"
echo "$HOME/flutter/bin/flutter doctor"
echo
echo "Hopefully it'll work for you :)"
#Other environment variable that may be useful to someone :).
## for bash shell paste this into the terminal.
#export PATH=$PATH:"$HOME/flutter/flutter/bin/"
#export PATH=$PATH:"$HOME/Android/Sdk/platform-tools"
#export PATH=$PATH:"$HOME/Android/Sdk/cmdline-tools/latest/bin/"
#export PATH=$PATH:"$HOME/Android/Sdk/build-tools/36.0.0-rc3/"
#export PATH=$PATH:"$HOME/Android/Sdk/emulator/bin64/"
## for fish shell paste this into the terminal.
#fish_add_path -g -p "$HOME/Android/Sdk/platform-tools"
#fish_add_path -g -p "$HOME/Android/Sdk/cmdline-tools/latest/bin/"
#fish_add_path -g -p "$HOME/Android/Sdk/build-tools/36.0.0-rc3/"
#fish_add_path -g -p "$HOME/Android/Sdk/emulator/bin64/"
flutter doctorsummary?