6

Android, Azure Devops geting error while run pipeline ##[error]Error: The process '/Users/runner/work/1/s/gradlew' failed with exit code 1

At locale system everything working apk generated but when run pipeline at azure devops it showing the error

FAILURE: Build failed with an exception.

* Where: Build file '/Users/runner/work/1/s/app/build.gradle' line: 2

* 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 11 to run. You are currently using Java 1.8.

I'm already using Java 11

I searched for same but not get any solution.

Rahul Mishra
  • 1,122
  • 1
  • 10
  • 25
  • Does this answer your question? [Android Studio Error "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8"](https://stackoverflow.com/questions/66980512/android-studio-error-android-gradle-plugin-requires-java-11-to-run-you-are-cur) – Ecstasy Mar 24 '22 at 05:39
  • 1
    Thanks for your reply @DeepDave-MT, at android studio everything works fine but the issue is at Azure devops while run pipeline – Rahul Mishra Mar 24 '22 at 05:47

2 Answers2

7

I have solved the issue by adding task for maven in azure-pipelines.yml

steps:
  - task: Maven@3
    inputs:
      mavenPomFile: 'pom.xml'
      publishJUnitResults: false
      javaHomeOption: 'JDKVersion'
      jdkVersionOption: '1.11'
      mavenVersionOption: 'Default'
      mavenOptions: '-Xmx3072m'

Hope this will helpful for other...

Rahul Mishra
  • 1,122
  • 1
  • 10
  • 25
2

I had a same issue and I solved it:

    - task: JavaToolInstaller@0
      inputs:
        versionSpec: '11'
        jdkArchitectureOption: 'x64'
        jdkSourceOption: 'PreInstalled'
etczrn
  • 31
  • 3