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

android studio can't find java #78

Closed lapisdecor closed 1 year ago

lapisdecor commented 3 years ago

After update to the latest flutter and dart plugins, android studio can't find java.


Running Gradle task 'assembleDebug'...

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

Exception: Gradle task assembleDebug failed with exit code 1```
lapisdecor commented 3 years ago

Also, I have a new Android folder on ~/ that I think wasn't previously there.

I'm using Android Studio 4.1 Build #AI-201.8743.12.41.6858069, built on September 23, 2020 Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 5.4.0-48-generic GC: ParNew, ConcurrentMarkSweep Memory: 1998M Cores: 6 Registry: ide.new.welcome.screen.force=true Non-Bundled Plugins: Dart, io.flutter Current Desktop: ubuntu:GNOME

om26er commented 3 years ago

I am not entirely sure if its related to the Android Studio snap package. FWIW, I have three instances of Android Studio updated to 4.1 and all seem to be working just fine. Need to wait to see if other people report that issue and can verify if non-snap installs are also affected.

lapisdecor commented 3 years ago

I had it working on another machine before the android studio and flutter updates. I did an update on that machine too and run into problems. The problem may not be the snap but the explosive combination of java / gradle versions and android studio not reseting (it assumes old configuration). I got android studio working after erasing .config/Google and .local/share/Google but I still run into problems with gradle < 6 (which I think is a flutter problem). Java version must be openjdk not oracle and <= 11 for things to work.

abderahimali commented 2 years ago

how to resolve problem path of android studio installed by snap

merlijn-sebrechts commented 1 year ago

Closing this as it was a java issue, not a snap issue.