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

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

Android,Azure Devops 在 运行 管道时出现错误 ##[error] 错误:进程“/Users/runner/work/1/s/gradlew”失败,退出代码为 1

在语言环境系统中,所有工作的 apk 都生成了,但是当 运行 管道在 azure devops 时它显示错误

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.

我已经在使用 Java11

我搜索了相同但没有得到任何解决方案。

我已经通过在 azure-pipelines.yml

中为 maven 添加任务解决了这个问题
steps:
  - task: Maven@3
    inputs:
      mavenPomFile: 'pom.xml'
      publishJUnitResults: false
      javaHomeOption: 'JDKVersion'
      jdkVersionOption: '1.11'
      mavenVersionOption: 'Default'
      mavenOptions: '-Xmx3072m'

希望这对其他人有所帮助...

我遇到了同样的问题,我已经解决了:

    - task: JavaToolInstaller@0
      inputs:
        versionSpec: '11'
        jdkArchitectureOption: 'x64'
        jdkSourceOption: 'PreInstalled'