Apply android API34(jdk 11) to Unity 2018

I’m trying to build an apk with api level 34 & jdk 11 on unity 2018.4.36f1.
but the system logs show that Unity is only compatible witn jdk 1.8(java 8).
and AGP requires jdk 11 or later.
Is there any way to build apk with jdk 11 in unity 2018?
The game is already published, so it is hard to update unity version to a higher one. also AGP must target higher than jdk11 to meet the new Google app policy.
thank u

* What went wrong:
A problem occurred evaluating root project 'gradleOut'.
> Failed to apply plugin 'com.android.internal.application'.
> **Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.**
Your current JDK is located in D:\ProgramFiles\UnityHub\Editors\2018.4.36f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows-\jre
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`.

9905817--1431165--upload_2024-6-24_18-42-38.png

I totally understand there could be valid reasons behind why it’s not upgradable to a newer version.
But, 2018 is too old!

Currently in the market, when it comes to unity version support on Android, we support the minimal version 2019.4.
This is because, there was lots of work to make it work on 2018 and latest android libraries. And also, my system doesn’t even run 2018 since past 1+ years for which reasons are unknown.

I would recommend to at-least try upgrading to 2019.4 and if possible 2021/2022+ with some effort.

Unfortunately, to try on 2018, I can’t run on my system to make it work.

Also, AGP 7+ needs Java 11 but I’m not sure why your AGP needs JAVA 11 as AGP version on 2018 should be <= 4.x mostly.

Great thanks for your advice, really appreciate that u understanding my issues and sharing your experience.
Actually, I really want to upgrade Unity version too. but I’m not a programmer(I’m a publisher)
Hope to find another solution soon… and I’ll share it if so!
Thanks again, have a great day!

Great! Ping us in-case if you find a solution or need any development assistance. We provide custom SDK’s for mobile publishers.