Oliver Hausler Oliver Hausler - 1 month ago 4x
Java Question

How to set Java version for non-Android module in Android Studio

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
section in
, 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.


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