Execution failed for task ':gradle-plugin:compileKotlin'

I’m not able to build my apk for my react native app. I keep getting this error…

C:\Users\tolul\Downloads\PROJECTS\NewMyFund\MyFundApp-frontend\MyFundApp-frontend\node_modules@react-native\gradle-plugin\src\main\kotlin\com\facebook\react\utils\TaskUtils.kt: (27, 12): Class ‘kotlin.collections.ArraysKt___ArraysKt’ was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from C:/Users/tolul/Downloads/gradle-8.5-bin/gradle-8.5/bin/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/gradle-8.5/lib/kotlin-stdlib-1.9.20.jar!/kotlin/collections/ArraysKt___ArraysKt.class

Task :gradle-plugin:compileKotlin FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:gradle-plugin:compileKotlin’.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details

  • Try:

Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:gradle-plugin:compileKotlin’.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)

8 actionable tasks: 1 executed, 7 up-to-date

Kotlin doc says that fully supported gradle for kotlin 1.9.20 is gradle 8.1. It looks like you are using gradle 8.5.