Android Gradle fail library. unity

Anyone knows how to fix it? I tried so many things including upgrading to new version of engine, using default ndk and skd, gradle, using android studio’s stuff instead of unity’s. no result

Do you have gradle template set, if so, it might be invalid. Try recreating it.

What do you mean by valid Gradle set? I am using unity’s built in Gradle although I did try to download Gradle myself, set up environment and etc. But it didn’t work

I am talking about these Unity - Manual: Gradle templates see if you have gradle templates set in PlayerSettings (Android)->Publishing Settings

Yeah I do have. I tried both unity’s Gradle and custom downloaded one. None work for me

Export gradle project from Unity and attach unityLibrary/build.gradle here, it says compiledSdkVersion is wrong

Solution for me was: use Gradle and android manifests from the version that was working properly. I also reinstalled unity with all it’s modules and Gradle that is compatible.
Also delete all third party SDKs.

I wish unity made a proper option to reinstall the android module in unity hub