When building Flutter
app in azure devOps
, I receive this error:
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`.
I've tried, these solutions:
- Creating
jitpack.yml
file, with- openjdk11
value. - Adding below lines to
app/build.gradle
file insideandroid {}
block:
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
And another solutions, but my error doesn't solve. By the way, I easily run app and build apk, locally on my mac without any errors, but when I push my code, Azure gives those build error.