question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED

See original GitHub issue

Initially encountered this error out of nowhere. By nowhere I mean it was working fine before I went to bed and it broke when I woke with no changes made on my end. Also, not exactly sure why I have this package installed. Haven’t specifically required it in my code.

M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandler.java:64: error: cannot find symbol
  private OnTouchEventListener<T> mListener;
          ^
  symbol:   class OnTouchEventListener
  location: class GestureHandler<T>
  where T is a type-variable:
    T extends GestureHandler declared in class GestureHandler
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandler.java:483: error: cannot find symbol
  public GestureHandler setOnTouchEventListener(OnTouchEventListener<T> listener) {
                                                ^
  symbol:   class OnTouchEventListener
  location: class GestureHandler<T>
  where T is a type-variable:
    T extends GestureHandler declared in class GestureHandler
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:26: error: cannot find symbol
import com.swmansion.gesturehandler.OnTouchEventListener;
                                   ^
  symbol:   class OnTouchEventListener
  location: package com.swmansion.gesturehandler
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:427: error: cannot find symbol
  private OnTouchEventListener mEventListener = new OnTouchEventListener() {
          ^
  symbol:   class OnTouchEventListener
  location: class RNGestureHandlerModule
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:427: error: cannot find symbol
  private OnTouchEventListener mEventListener = new OnTouchEventListener() {
                                                    ^
  symbol:   class OnTouchEventListener
  location: class RNGestureHandlerModule
Note: M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

Did some digging around, suggestion was to add in gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

Now I’m getting more errors:

M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandler.java:64: error: cannot find symbol
  private OnTouchEventListener<T> mListener;
          ^
  symbol:   class OnTouchEventListener
  location: class GestureHandler<T>
  where T is a type-variable:
    T extends GestureHandler declared in class GestureHandler
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandler.java:483: error: cannot find symbol
  public GestureHandler setOnTouchEventListener(OnTouchEventListener<T> listener) {
                                                ^
  symbol:   class OnTouchEventListener
  location: class GestureHandler<T>
  where T is a type-variable:
    T extends GestureHandler declared in class GestureHandler
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:3: error: package android.support.v4.util does not exist
import android.support.v4.util.Pools;
                              ^
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:19: error: package Pools does not exist
  private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
                            ^
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:26: error: cannot find symbol
import com.swmansion.gesturehandler.OnTouchEventListener;
                                   ^
  symbol:   class OnTouchEventListener
  location: package com.swmansion.gesturehandler
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:427: error: cannot find symbol
  private OnTouchEventListener mEventListener = new OnTouchEventListener() {
          ^
  symbol:   class OnTouchEventListener
  location: class RNGestureHandlerModule
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:3: error: package android.support.v4.util does not exist
import android.support.v4.util.Pools;
                              ^
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
  private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
                            ^
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:20: error: package Pools does not exist
          new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
                   ^
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:427: error: cannot find symbol
  private OnTouchEventListener mEventListener = new OnTouchEventListener() {
                                                    ^
  symbol:   class OnTouchEventListener
  location: class RNGestureHandlerModule
M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist
          new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
                   ^
Note: M:\Google Drive\SC\frontenda\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
11 errors

package.json

{
  "name": "frontenda",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
    "clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
    "newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
    "test:watch": "jest --watch",
    "updateSnapshot": "jest --updateSnapshot",
    "coverage": "jest --coverage && open coverage/lcov-report/index.html || xdg-open coverage/lcov-report/index.html",
    "android:build": "cd android && ./gradlew assembleRelease",
    "android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease",
    "android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk",
    "android:devices": "$ANDROID_HOME/platform-tools/adb devices",
    "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
    "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
    "storybook": "storybook start -p 7007",
    "lint": "standard --verbose | snazzy",
    "lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
    "fixcode": "standard --fix",
    "git-hook": "npm run lint -s && npm run test -s"
  },
  "dependencies": {
    "apisauce": "^1.0.2",
    "axios": "latest",
    "format-json": "^1.0.3",
    "identity-obj-proxy": "^3.0.0",
    "lodash": "^4.17.11",
    "prop-types": "15.7.2",
    "querystringify": "2.1.0",
    "ramda": "^0.26.1",
    "react": "16.8.3",
    "react-native": "0.59.3",
    "react-native-animatable": "^1.3.2",
    "react-native-app-intro-slider": "^2.0.1",
    "react-native-config": "^0.11.7",
    "react-native-device-info": "1.6.1",
    "react-native-elements": "^1.1.0",
    "react-native-geolocation-service": "^2.0.1",
    "react-native-gesture-handler": "^1.3.0",
    "react-native-i18n": "2.0.14",
    "react-native-permissions": "^1.1.1",
    "react-native-reanimated": "^1.0.1",
    "react-native-sideswipe": "^1.5.0",
    "react-native-snap-carousel": "^3.8.0",
    "react-native-tab-view": "^2.5.0",
    "react-native-textinput-effects": "^0.5.1",
    "react-native-ticker": "^2.2.1",
    "react-native-vector-icons": "^6.5.0",
    "react-native-view-overflow": "0.0.4",
    "react-navigation": "3.0.0",
    "react-navigation-redux-helpers": "^2.0.6",
    "react-redux": "^6.0.0",
    "redux": "^4.0.0",
    "redux-persist": "5.10.0",
    "redux-saga": "^1.0.0",
    "reduxsauce": "1.0.1",
    "seamless-immutable": "^7.1.4"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/runtime": "^7.4.5",
    "@storybook/addon-actions": "5.0.11",
    "@storybook/addon-links": "5.0.11",
    "@storybook/addon-storyshots": "^4.1.11",
    "@storybook/addons": "^4.1.11",
    "@storybook/channels": "^4.1.11",
    "@storybook/react-native": "^4.1.11",
    "babel-core": "6.26.3",
    "babel-eslint": "7.1.1",
    "babel-jest": "^24.8.0",
    "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react-native": "^4.0.1",
    "enzyme": "^3.2.0",
    "enzyme-adapter-react-16": "^1.1.0",
    "ignite-andross": "^4.0.5",
    "ignite-animatable": "1.0.2",
    "ignite-dev-screens": "2.4.5",
    "ignite-i18n": "1.2.0",
    "ignite-keychain": "^1.0.0",
    "ignite-redux-persist": "1.1.2",
    "ignite-standard": "1.0.0",
    "ignite-vector-icons": "1.1.1",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.54.1",
    "mockery": "^2.1.0",
    "react-devtools-core": "3.6.0",
    "react-dom": "16.7.0",
    "react-test-renderer": "16.8.3",
    "reactotron-react-native": "^2.1.0",
    "reactotron-redux": "^2.1.0",
    "reactotron-redux-saga": "^3.0.0",
    "snazzy": "^8.0.0",
    "standard": "10.0.2"
  },
  "jest": {
    "preset": "react-native",
    "testMatch": [
      "<rootDir>/Tests/**/*.js",
      "**/?(*.)(spec|test).js?(x)"
    ],
    "testPathIgnorePatterns": [
      "/node_modules/",
      "<rootDir>/Tests/Setup.js"
    ],
    "moduleNameMapper": {
      "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
    },
    "transform": {
      "^.+\\.(js)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    },
    "setupFiles": [
      "<rootDir>/Tests/Setup"
    ]
  },
  "config": {},
  "standard": {
    "parser": "babel-eslint",
    "globals": [
      "describe",
      "test",
      "jest",
      "expect",
      "fetch",
      "navigator",
      "__DEV__",
      "XMLHttpRequest",
      "FormData",
      "React$Element"
    ]
  }
}

Edit: Switched to v1.0.10 and now I’m getting this instead

Task :app:transformClassesWithMultidexlistForDebug FAILED
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives:
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel$Stub

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:24
  • Comments:27 (1 by maintainers)

github_iconTop GitHub Comments

122reactions
sunilpatidarcommented, Jul 11, 2019

adding 2 lines to gradle.properties under android android.useAndroidX=true android.enableJetifier=true

run following command

npm install -g jetifier npx jetify

116reactions
Harsh2402commented, Jul 8, 2019

It causes this error for the RN 0.60. You can solve this by following,

npm i jetifier
npx jetify

fixed it for me on RN 0.60.

Have a good day.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution failed for task ':react-native-gesture-handler ...
The new version is 1.3.0. Here is the error: Task :react-native-gesture-handler:compileDebugJavaWithJavac
Read more >
Execution failed for task ':react-native-gesture ... - Stack Overflow
It cause this error for the RN 0.60 . You can solve this by following, npm i jetifier npx jetify. fixed it for...
Read more >
execution failed for task ':react-native-gesture-handler ...
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle ...
Read more >
Execution failed for task ':react-native-gesture-handler ...
Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac' ; 1. //Add the following to the gradle.properties to activate AndroidX ; 2.
Read more >
react-native-gesture-handler:compileDebugJavaWithJavac ...
> Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED - run-android breaks after installation #921 · Version of react-native-iap · Version of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found