Appcenter ms Android Gradle plugin requires Java 17
Asked Answered
R

2

10

Android Studio Giraffe | 2022.3.1 I updated my proyect to gradle 8.0, androidGradlePluginVersion = '8.1.0' it asked to update java version

 compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

AS works fine

We are using Appcenter ms to distribute the builds but its not compiling the builds with this upgrated

Getting this error from Appcenter

Failed to apply plugin 'com.android.internal.library'.
   > Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
      Your current JDK is located in /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.19-7/x64/Contents/Home
      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`.

Any ideas how handle it? we are already set the Environment variables with java 11 enter image description here

Rightwards answered 7/8, 2023 at 19:52 Comment(2)
Have the same question but couldn't figure out the solution though. However, in dev azure pipeline I was able to figure out how to set java 17 which is under advance collapsable under gradle build task. Not certain how to set in app center though(for a different project)Pricilla
@SamReyes take a look at my answer, I use app center and I ran into the same error as well and I was able to fix it by changing app center environment variableJaenicke
J
8

I got he same error in app center.

I fixed it by changing the Environment variables JAVA_HOME

from

$(JAVA_HOME_11_X64)

to

$(JAVA_HOME_17_X64).

Jaenicke answered 16/8, 2023 at 17:58 Comment(0)
P
5

This worked for me as suggested by Not A Programmer. Hope it helps

enter image description here

Pricilla answered 22/8, 2023 at 15:17 Comment(1)
should I support JAVA 17 in my code? compileOptions { coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" }Godchild

© 2022 - 2024 — McMap. All rights reserved.