0

In Android Studio, under File, Project Structure I can set the path to the JDK and with this the Java version. The command seems misplaced here as Project Structure suggests the structure of the current project, though this is a general setting for all projects.

Then, in the same dialog, I can go to modules and set a different Java version under source/target compatibility there, but as How to set -source 1.7 in Android Studio and Gradle states, this setting only changes the android section in gradle, so it seems to be available only for Android projects.

  • Where can I set the Java version on a per project/per module basis for non-Android modules.

Can anybody explain which setting changes what, or where this is documented.

Community
  • 1
  • 1
Oliver Hausler
  • 4,900
  • 4
  • 35
  • 70

1 Answers1

0

You can define custom java versions for each module via the gradle.properties file. You can find more about it here: https://docs.gradle.org/current/userguide/build_environment.html

You might want to use

org.gradle.java.home=PATH_TO_YOUR_JAVA_HOME
and_dev
  • 3,723
  • 1
  • 20
  • 28