Install Android Studio on an external SSD for Flutter
2 min read

Install Android Studio on an external SSD for Flutter

Fixing errors when using Android Studio on an external SSD for Flutter development.

When I work in the office I use a desktop with a one terabyte Fusion drive. That is plenty of storage for my development needs. On the laptop I use when I work from home, on the other hand, the available storage is low. Too low to run all the development tools I need.

For this reason, I decided to install Android Studio on an external SSD.

I downloaded it from the official website, moved it to the SSD, which I named Skynet, and launched it.

During installation I chose a custom setup, to set the location of the Android SDK to a folder in the SSD.

Then I run flutter doctor, but I got the error Android license status unknown.

So I run flutter doctor --android-licenses, which gave me a very weird message.

flutter doctor --android-licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more

After a quick Internet search, I opened Android Studio and clicked Configure.

And I added two packages:

  • NDK (Side by Side)
  • Android SDK Command-line Tools (latest)

I guess only the command-line tools are needed.

At this point flutter doctor --android-licenses worked as expected, but flutter doctor still complained that Android Studio was not installed.

➜  ~ flutter doctor                   
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.6 19G2021, locale en)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[!] Android Studio (not installed)
[✓] VS Code (version 1.48.2)
[!] Connected device

! Doctor found issues in 2 categories.

So I run flutter config --android-studio-dir /Volumes/Skynet/Android\ Studio.app, and finally, no errors.

➜  ~ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.6 19G2021, locale en)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.48.2)
[!] Connected device

! Doctor found issues in 1 category.

🥳

Wanna stay up-to-date with Flutter and Dart?

Subscribe to get a weekly email with the best articles about Flutter and Dart.

    We won't send you spam. Unsubscribe at any time.