Android Studio Snap directory name change causes critical issues for Flutter

So I’ve started getting errors that Android Studio’s bundled java can’t be found when I run flutter doctor:

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.4, on Ubuntu 22.04.2 LTS 5.19.0-43-generic, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    ✗ No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and
      the java binary in your PATH. You can download the JDK from
      https://www.oracle.com/technetwork/java/javase/downloads/.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] Android Studio (version 2021.3)
[!] Android Studio
    ✗ android-studio-dir = /snap/android-studio/current/android-studio
    ✗ Unable to find bundled Java version.
[✓] VS Code
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.

I’ve noticed a change that the /snap/android-studio/current/android-studio/jre is renamed to /snap/android-studio/current/android-studio/jbr now that is an easy fix that’s done by just changing the env var in ~/.bashrc, or so I thought.

So after fixing my environment variable I still get this error:

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.4, on Ubuntu 22.04.2 LTS 5.19.0-43-generic,
    locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] Android Studio (version 2021.3)
[!] Android Studio
    ✗ android-studio-dir = /snap/android-studio/current/android-studio
    ✗ Unable to find bundled Java version.
[✓] VS Code
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

No biggie, I thought. I’ll just symlink jre to jbr. No luck, it’s a snap read only file system.

Guys, please advise on how to proceed. Ty!

The snap seems unmaintained, you should try another version of android studio. See this video to install the recent edition directly from the tar file --> https://developer.android.com/static/studio/videos/studio-install-linux.mp4

More on --> https://developer.android.com/studio/install

You can try the flatpak one for more ease but its also not official plus i cant guarantee if everything will work there fine too.

I would add a suggestion to expose your issue here (follow the link) so it is handled beforehand for future releases (if possible). The maintainer have recently opened an issue for enhancements, that’s where the link will take you.

Cheers

what makes you think that ? it had its last stable release in may … does not look unmaintained at all …

I see that snap issues still persist, suddenly the Flutter snap can’t figure out the versions of other snaps :’(

$ flutter doctor -v
[✓] Flutter (Channel stable, 3.13.1, on Ubuntu 22.04.3 LTS 6.2.0-31-generic, locale en_US.UTF-8)
    • Flutter version 3.13.1 on channel stable at /home/$USER/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e1e47221e8 (7 days ago), 2023-08-22 21:43:18 -0700
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/$USER/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /snap/android-studio/current/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2022.2)
    • Android Studio at /snap/android-studio/126/android-studio
    • Flutter plugin version 74.0.2
    • Dart plugin version 222.4582
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.3)
    • Android Studio at /snap/android-studio/127/android-studio
    • Flutter plugin version 75.1.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[!] Android Studio (version unknown)
    • Android Studio at /snap/android-studio/current/android-studio/
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • android-studio-dir = /snap/android-studio/current/android-studio/
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version unknown)
    • VS Code at /snap/code/current
    • Flutter extension version 3.68.0
    ✗ Unable to determine VS Code version.

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.3 LTS 6.2.0-31-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 116.0.5845.110

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.