It happens because the project is having a Gradle version which is incompatible with the Java version selected in the android studio. As of writing this the default android installation comes with Java 21 as configured java.
The solution is to download the version of Java that your project supports (for react native it’s Java 17). Add it’s bin folder path to environment variable. Then change the SDK
Settings -> Build,Execution,Deployment -> Build tools -> gradle -> Gradle jdk -> choose Java version based on your gradle version.
And now simply sync the gradle.
Helpful links:
Compatibility Matrix (gradle.org)
Cheers and Peace out!!!