1

I have started to implement the CI-CD using GitHub Actions and integrate lint into main.yml, but I am getting errors like:

Run ./gradlew lintDebug
Downloading https://services.gradle.org/distributions/gradle-8.0-bin.zip
...........10%............20%............30%............40%............50%............60%...........70%............80%............90%............100%

Welcome to Gradle 8.0!

For more details see https://docs.gradle.org/8.0/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file '/home/runner/work/ci-cd-example/ci-cd-example/app/build.gradle.kts' line: 1

* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
      Your current JDK is located in /usr/lib/jvm/temurin-11-jdk-amd64
      You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 22s
Error: Process completed with exit code 1.

I have changed JAVA_HOME to Java version 17. Here is the version detail, which I got by applying the command java -version in the terminal (I am using Mac)

openjdk version "17.0.8.1" 2023-08-24
OpenJDK Runtime Environment Homebrew (build 17.0.8.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.8.1+0, mixed mode, sharing)

I have also checked the Gradle JDK version of the code and it is also set with the JAVA_HOME.

Here, I want to know which JDK GitHub takes to run the main.yml file, and whether I can change the JDK config for GitHub Actions.

1 Answer 1

1

Looks like you haven't mentioned the JDK version externally in the .github/workflows.main.yml file.

Here is the way to mention externally:

runs-on: ubuntu-latest
steps:
  - name: Checkout the code
    uses: actions/checkout@v2

  - name: Set up Java
    uses: actions/setup-java@v2
    with:
      distribution: "temurin"
      java-version: 17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .