Hi,
the gradle error gave me a hard time aswell. Eventually i found out the gradle error pops up when you have wrong SDK, NDK and JDK setup. I’ll leave here what helped me to resolve the problem in UE 4.27.2:
Install Android studio 4.0 (Android Studio download archives | Android Developers)
In Android studio in SDK Manager - SDK Platforms download all APIs from 33 to 19
In SDK Tools download Build-Tools 29.0.3 and 29.0.2 and download NDK 21.4.7075529. If you have other versions, delete them.
In UE in project settings go to Platforms - Android SDK and set paths for your SDK, NDK and JDK:
Location of Android SDK: C:/NVPACK/android-sdk-windows
Location of Android NDK: C:/NVPACK/android-sdk-windows/ndk/21.4.7075529
Location of JAVA: C:/Program Files/Android/Android Studio/jre (it installs with android studio 4.0)
Set SDK and NDK API Level to android-30
Go to the section Android (in Project settings) and set Minimum SDK version to 21 and Target SDK Version to 30.
After that the gradle error was no longer problem to me. Hope it helps