snapcrafters / android-studio

A community-maintained package to easily install Android Studio on Linux
https://developer.android.com/studio/index.html
47 stars 16 forks source link

[Enhancement]: Release Android Studio Giraffe when its released #106

Closed om26er closed 8 months ago

om26er commented 1 year ago

What changes would you like?

This issue is to track the new incoming release Giraffe, which is already at Beta 3 -- it likely be stable in a couple of weeks.

Any extra information?

No response

KristijanZic commented 1 year ago

Android Studio Snap directory name change causes critical issues for Flutter, idk if this can be reverted.

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.

I think it would be good to revert jbr name back to jre.

om26er commented 1 year ago

Here is the relevant Flutter issue https://github.com/flutter/flutter/pull/119244 -- it seems the rename from jre to jbr is intentional by Google

om26er commented 11 months ago

Giraffe is now in the edge channel. Would be helpful to have some testing

KristijanZic commented 11 months ago

The issue persists. Running flutter doctor gives:

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on Ubuntu 22.04.2 LTS
    5.19.0-50-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 2022.3)
[!] Android Studio
    ✗ android-studio-dir = /home/aresminos/Android/Sdk
    ✗ Unable to find bundled Java version.
[✓] VS Code
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.

The issue is that flutter expects to find jre directory in the /home/user/Android/Sdk while the Android Studio snap recently moved that to /snap/android-studio/current/android-studio/jbr.

The problem is, in flutter config we can only define android-studio-dir which is /home/aresminos/Android/Sdk but we can't define jre or jbr directory separately. Flutter is looking for that in android-studio-dir/jre/bin/java by default and I can't find a way to change it.

The only workaround I've found so far is to manually link /home/aresminos/Android/Sdk/jre to /snap/android-studio/current/android-studio/jbr. It seems to work but it's not how it should stay.

I've tried setting JAVA_HOME and PATH in different ways to /snap/android-studio/current/android-studio/jbr to see if that would work but no use. The only workaround is to link it.

popey commented 8 months ago

Closing this because 2022.3.1.20 is now in stable.