Forked from steveclarke/Install Android SDK CLI Ubuntu 20.04 WSL2.md
Last active
November 1, 2023 16:05
-
-
Save FaikYY/b89c7d88c05cce013365af7b455d1690 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Flutter and Android Sdk (Virtual Machine) on Ubuntu 20.04LTS without Android Studio | |
## Install Java 8 | |
```bash | |
sudo apt install openjdk-8-jdk-headless | |
``` | |
### Install the flutter package from the website | |
### from here https://flutter.dev/docs/get-started/install/linux | |
### extract it and rename as .flutter to make it hidden (optional) | |
### export the file in .bashrc or .zshrc | |
export PATH="$PATH:~/.flutter/flutter/bin" | |
## Android SDK | |
```bash | |
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip | |
mkdir -p Android/Sdk | |
unzip commandlinetools-linux-6200805_latest.zip -d Android/Sdk | |
export ANDROID_HOME=$HOME/Android/Sdk | |
# Make sure emulator path comes before tools. Had trouble on Ubuntu with emulator from /tools being loaded | |
# instead of the one from /emulator | |
export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH" | |
sdkmanager --sdk_root=${ANDROID_HOME} "tools" | |
sdkmanager --update | |
sdkmanager --list | |
sdkmanager "build-tools;30.0.3" "platform-tools" "platforms;android-30" "tools" | |
sdkmanager --licenses | |
sdkmanager "system-images;android-30;google_apis_playstore;x86" | |
sudo apt install gradle | |
# to create a virtual machine | |
flutter emulators --create --name androtest | |
# to run the virtual machine (eventhough we set the name as androtest its saving as flutter_emulator, dont know why??) | |
flutter emulators --launch androtest | |
# cd into flutter project and | |
flutter run | |
```` | |
Note: you can get an updated Android SDK link from https://developer.android.com/studio/#downloads | |
Used a combinaton of these gists: | |
https://gist.github.com/fedme/fd42caec2e5a7e93e12943376373b7d0 | |
https://gist.github.com/jjvillavicencio/18feb09f0e93e017a861678bc638dcb0 | |
Background on the update to command line tools from android sdk | |
https://stackoverflow.com/a/61176718 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flutter instructions added