Cannot Build To Android For SDK reasons

I currently cant find any way to build my android game. I’ve tried a multitude of different things and gotten alot of different errors on it. First without changing settings and using the sdk and gradle that come with Unity (version 2022.3.8f1) I get the error :
Android SDK does not include your

Target SDK of 28.
Please use the Android SDK Manager to install your target SDK version. Restart Unity after SDK installation for the changes to take effect.

I’ve tried different SDKs bot none of them work and I get the same error with a different SDK.
After installing the sdk, command line tools and setting the directory through the manager I avoided this error but got another one :

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Error: LinkageError occurred while loading main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I installed the latest JDK (20) but Unity tells me it only works with version 11. This would mean that it just cant build it as I would need version 17 to reach it. Is there anything else I can do to build successfully?

I was facing the same issue
Downgrading to a lower version of SDK Command-line Tools worked for me

I referred the answer in this forum:
https://stackoverflow.com/questions/76882205/error-linkageerror-occurred-while-loading-main-class-com-android-sdklib-tool-sd

thanks, I think it might be agradle thing and less about the SDK. it is super weird how it doesn’t work

I have the same problem and I did dowggred but soon after the system complains that I have to use version 8 of Java

For me the settings changes for Android SDK worked. Make sure you have installed required Android SDK in Android Studio. (I am using Unity 2023.2.1, Android API 34). For settings changes, go to Edit->Preferences->External Tools, there (if not selected) tick on ‘Android SDK Tools Installed with Unity (recommended)’.