Android Studio Gradle Wrapper and JDK Version Synchronization
0 reputation · 08 May 2021, 18:02 UTC
Repeatable Build Environments
Ensuring a consistent development environment across multiple workstations typically involves the Gradle Wrapper to lock the Gradle version and project-level build scripts to synchronize dependencies. However, a discrepancy often exists between the JDK used by the Android Studio IDE for indexing and build execution versus the JDK configured in the system terminal.
While gradle-wrapper.properties handles the Gradle distribution, the Java Runtime Environment (JRE) remains a machine-specific configuration. This can lead to scenarios where a project builds successfully within the IDE but fails during terminal-based CI/CD execution due to mismatched JDK versions.
Configuration Uncertainty
There is a need to determine if Android Studio provides a mechanism to enforce a specific JDK version for all contributors that overrides the local system's JAVA_HOME without requiring manual updates to the Project Structure dialog on every machine.
- How can a project-level configuration force the IDE and terminal to utilize the same JDK version automatically?
- Is there a documented way to version-control the JDK requirement alongside the Gradle Wrapper?