We found the following way is the easiest one to setup Android Studio together with flutter and dart.
- Download a copy
git clone https://github.com/flutter/flutter.git
- Edit /etc/profile,
sudo nano /etc/profile
- Update path
[Read more at: https://flutter.dev/docs/get-started/install/chromeos#update-your-path]
Locate the following section, add your path and save the file:
if [ "
id -u
" -eq 0 ]; then
PATH="..."
else
PATH="/usr/local/bin:...:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
fi
export PATH
-
Make sure ADB debugging is enabled: Settings > Linux > Develop Android apps > Enable ADB debugging
-
Restart Linux virtual machine
-
Pre-download development binaries:
flutter precache
- Run on terminal:
flutter doctor
- Select "Always allow from this computer" to authorize connect flutter to your Chromebook upon prompting "Allow USB debugging?"
- Run on terminal the following command and accept all licenses upon prompting:
flutter doctor --android-licenses
- At this point, you should be able to create a new flutter project in Android Studio and test your project with your chromebook directly. To have a final check, run:
flutter doctor
It should looks like:
Please note that VS Code is optional.
-
Go to https://developer.android.com/studio (with a Chrome OS browser, not with a Linux browser, so that it automatically directs to a download link for the Chrome os version of Android Studio.)
-
Download Chrome OS installation file for Chrome OS
-
Open "Files" app, go to "Downloads" folder and locate the downloaded file. In our testing, the file name is "android-studio-ide-201.7199119-cros.deb".
-
Right click and select "Install with Linux"
-
Launch after installation is finished, via either launcher or running "/opt/android-studio/bin/studio.sh" on terminal
-
Follow the "Setup Wizard" to complete the setup.
-
On welcome screen, select "Configure > Plugins"
-
Search for "flutter" and install flutter plugin
-
Restart Android Studio after installing "flutter" plugin
You may encounter the following warning:
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 57 package 'android-studio': missing 'Maintainer' field
To get rid of this warning:
- Run
sudo nano /var/lib/dpkg/status
-
Use "ctrl + shift + -" key combination to go to line 57
-
Enter "Maintainer: "
-
Save the file (ctrl + o + enter) and exit (ctrl + x)
echo "alias studio=/opt/android-studio/bin/studio.sh & disown" >> ~/.bashrc
studio
If you lanch Android Studio by click its icon on Launch, you may find flutter command now available. You may need to set assign further variables. A simple solution is to launch studio from terminal you can find flutter command works directly from Android Studio's integrated terminal.
You may read the section above on creating an alias: https://github.com/eliranwong/ChromeOSLinux/blob/main/development/AndroidStudioFlutter.md#create-an-alias-for-use-in-terminal