11

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

[

BUILD FAILED in 3m 54s

at makeError (C:\Users\Zsola\Desktop\NoruHotels\node_modules\execa\index.js:174:9)
at C:\Users\Zsola\Desktop\NoruHotels\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\Zsola\Desktop\NoruHotels\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\Zsola\Desktop\NoruHotels\node_modules\@react-native-community\cli\build\index.js:192:9)

info Run CLI with --verbose flag for more details.

i tried this with ai

This error occurs when there is an issue with the Kotlin compilation process for the react-native-gesture-handler library. Here are some steps you can take to resolve the issue:

  1. Make sure that you have the correct version of Kotlin Gradle Plugin installed. You can check the version in your project's build.gradle file under dependencies.

  2. Try cleaning and rebuilding your project by running the following commands in your project directory:


cd android
./gradlew clean
cd ..
react-native run-android

  1. If the issue persists, try updating your Kotlin version by adding the following line to your project's build.gradle file:

ext.kotlin_version = '1.5.21'

Then update the Kotlin Gradle Plugin version to match:

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"

  1. If none of the above steps work, try disabling Kotlin compilation for the react-native-gesture-handler library by adding the following line to your project's build.gradle file:
configurations.all {
    exclude group: 'com.facebook.react', module: 'react-native-gesture-handler'
}

Then run react-native run-android again.

Hopefully one of these steps will resolve the issue for you.

8 Answers 8

16

I solved it by upgrading my react-native-gesture-handler to version 2.9.0.

  1. Update package.json: Open your project's package.json file and find the dependency for react-native-gesture-handler. Change the version number to "2.9.0" (don't forget to remove ^). It should look like this:

    "dependencies": {
      "react-native-gesture-handler": "2.9.0",
      // other dependencies...
    }
    
  2. Uninstall the node_modules folder.

  3. Run npm install

  4. Try building your project now

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot even with compaible versions it was failing.Removing ^ worked
It also solved my problem. I removed ^.
3

Not sure why, but this seems to solve my problem.

1: Add a String to android/build.gradle

kotlinVersion = "1.8.10"

2: Delete node_modules folder

rm -r node_modules

3:npm i

4:npx react-native run-android

Also run VS code (if you're working in it) as an administrator.

Comments

3

updating my android build.gradle buildscript to

buildscript {
    ext {
        buildToolsVersion = '33.0.0'
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
  }
....
}

worked for me

Comments

1

Install the below packages with specific versions that will resolve your error :

npm i @react-native-community/[email protected] @react-navigation/[email protected] @react-navigation/[email protected] [email protected] [email protected] [email protected] [email protected]

and import :

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

Comments

1

I had the same issue and I tried to version trick but didn't helped. From the solution was to check the react-native-gesture-handler documentation where I saw that for my version of react native (0.73.6) I need to use version 2.18.0+ so I moved to "react-native-gesture-handler": "2.18.1", deleted the package-lock.json (not sure if I needed to, but just in case) file and run npm i. Then npm start run without issues.

Comments

0

If the error is related to cxx modules, add this classpath("com.android.tools.build:gradle:7.3.1") on android/build.gradle.

Also check this issue

Comments

0

Add this line

=> kotlin_version = '1.5.21'

or

=> kotlinVersion = "1.8.10"

to

=> android/build.gradle

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

In my case I had my dependenci "react-native-gesture-handler": "~2.9.0" so I replace the "~" for "^":

"dependencies": {
  "react-native-gesture-handler": "^2.9.0",
  // other dependencies...
}

Uninstall the node_modules folder. Run npm install Try building your project now

1 Comment

you need to make the visual difference clear between code and answer content

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.