runningcode / gradle-doctor

The right prescription for your Gradle build.
http://runningcode.github.io/gradle-doctor
Apache License 2.0
736 stars 48 forks source link

Unable to set JAVA_HOME in Android Studio Arctic Fox #174

Closed snpefk closed 2 years ago

snpefk commented 2 years ago

In arctic fox version Android Studio options for set project JDK through JAVA_HOME is missing. It seems like "Arctic Fox" version of Android Studio rework settings for "Project Structure" (moving JDK Location to Gradle Settings) and Gradle JDK combobox doesn't show JAVA_HOME option in "Gradle JDK" setting (although, I set env in .zshrc and even in .profile, just to be sure). Screenshot from 2021-10-14 17-38-03

As workaround I'm disabled failOnError, but recommendation specified on this page does not work for me.

runningcode commented 2 years ago

Thanks for reporting. This is interesting. I wonder why this option is missing.

ColtonIdle commented 2 years ago

This seems like an intellij issues as I've had similar problems in the past, and the only thing I've done to fix it was:

  1. Kill jetbrains toolbox
  2. restart computer (or sign out and back in with your user)
  3. Go to Preferences > Terminal > "Shell Integration"

I'd still say this is probably the wrong place for this issue. If you open this issue on googles issuetracker or on youtrack I'll star it!

rciovati commented 2 years ago

FYI you can also use the STUDIO_GRADLE_JDK env variable instead of setting JAVA_HOME manually in the ide (source)

Drjacky commented 2 years ago

@rciovati Didn't help. I still get the error on AS 2021.1.1:

A problem occurred configuring root project 'MVVMTemplate'.
> =============================== Gradle Doctor Prescriptions ============================================
  | JAVA_HOME is not set.                                                                                |
  | Please set JAVA_HOME so that switching between Android Studio and the terminal does not trigger a fu |
  | ll rebuild.                                                                                          |
  | To set JAVA_HOME: (using bash)                                                                       |
  | echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile                                 |
  | or `~/.zshrc` if using zsh.                                                                          |
  |                                                                                                      |
  ========================================================================================================

While the JAVA_HOME is set

ColtonIdle commented 2 years ago

Looks like it's an issue because of intellij https://issuetracker.google.com/issues/216364005 https://twitter.com/softwarejameson/status/1486192383716909057

runningcode commented 2 years ago

Closing since this is an issue in intellij.