在azure devOps中构建azure devOps应用程序时,我会收到以下错误:
Build file 'D:\a\1\s\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
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`.我试过,这些解决方案:
jitpack.yml文件,其中包含- openjdk11值。android {}块中将以下行添加到app/build.gradle文件:F 212
..。
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}还有另一个解决方案,但我的错误解决不了。顺便说一句,我很容易运行应用程序和构建apk,在我的mac上本地没有任何错误,但是当我推送我的代码时,Azure会给出这些构建错误。
发布于 2022-05-06 11:23:57
通过将以下行添加到azure-pipelines.yml文件中,可以解决我的错误:
steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'https://stackoverflow.com/questions/72140664
复制相似问题