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
The exact same thing happened to me. My best guess is that there some update to the android sdks
The last error you got seems to be due to the new AndroidX support libraries
I found som info here:
https://github.com/kmagiera/react-native-gesture-handler/pull/589
https://github.com/react-native-community/react-native-viewpager/pull/22
I have the same issue, i try to downgrade and update react-native-gesture-handle but doesn't works form me.
RN 0.59
react-native-gesture-handle 1.2.1
Having the same issue, build specs:
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 26.11 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.10.0 - ~/.nodenv/versions/10.10.0/bin/node
Yarn: 1.16.0 - ~/.nodenv/versions/10.10.0/bin/yarn
npm: 6.9.0 - ~/.nodenv/versions/10.10.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.0
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Gradle 5.4.1
------------------------------------------------------------
Build time: 2019-04-26 08:14:42 UTC
Revision: 261d171646b36a6a28d5a19a69676cd098a4c19d
Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_152 (Oracle Corporation 25.152-b16)
OS: Mac OS X 10.14.5 x86_64
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 24
compileSdkVersion = 28
targetSdkVersion = 26
supportLibVersion = "28.0.0"
}
gradle.properties
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"
dependencies
dependencies {
implementation project(':@react-native-community_async-storage')
implementation (project(':react-native-push-notification'), {
exclude group: "com.google.android.gms"
exclude group: "com.google.firebase"
})
implementation project(':react-native-config')
implementation project(':react-native-sensitive-info')
implementation project(':react-native-webview')
implementation (project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation project(':react-native-gesture-handler')
implementation project(':react-native-vector-icons')
implementation "com.google.android.gms:play-services-gcm:16.1.0"
implementation "com.google.firebase:firebase-messaging:17.6.0"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
For me works,
i excludes
android.useAndroidX=true
android.enableJetifier=true
from gadle.properties
So had to update two libs [email protected] and [email protected]
Just it
For me this seems to work now: https://github.com/react-native-aar/react-native-gesture-handler
Actually these needed to be set false in your gradle.properties file:
android.useAndroidX=false
android.enableJetifier=false
Changed all settings but forgot about these 2 important flags 馃槃 . Will only be supported from RN 0.60.+. Building package using Android Studio didn't work, just use:
cd android
./gradlew bundleRelease
For me works,
i excludes
android.useAndroidX=true
android.enableJetifier=true
from gadle.propertiesSo had to update two libs [email protected] and [email protected]
Just it
Upgrading these two made it work thanks
android.useAndroidX=false
android.enableJetifier=false
when i try to run-android it works but cd android
./gradlew bundleRelease still says =>
FAILURE: Build failed with an exception.
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
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.
@Harsh2402 found the best and simpliest fix. I really didn't understand why but it worked.
Can any one of the contributors help us to understand why?
@zscaiosi
You can refer the following link,
https://facebook.github.io/react-native/blog/2019/07/03/version-60
For the AndroidX migration, we need to fix that with jetifier.
adding 2 lines to gradle.properties under android
android.useAndroidX=true
android.enableJetifier=true
run following command
npm install -g jetifier
npx jetify
sunilpatidar's answer worked for me
adding 2 lines to gradle.properties under android
android.useAndroidX=true
android.enableJetifier=true
run following command
npm install -g jetifier
npx jetify
adding 2 lines to gradle.properties under android
android.useAndroidX=true
android.enableJetifier=truerun following command
npm install -g jetifier
npx jetify
Working for me. I need clean the project after exec this commands but works!
react-native link solved the issue
Nothing is work for me as i tried all of these react-native .60
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Nothing is work for me as i tried all of these react-native .60
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Did you try this?
For me works,
i excludes
android.useAndroidX=true
android.enableJetifier=true
from gadle.properties
So had to update two libs [email protected] and [email protected]
Just it
adding 2 lines to gradle.properties under android
android.useAndroidX=true
android.enableJetifier=truerun following command
npm install -g jetifier
npx jetify
He saved my day :))
Where is gadle.properties?
Where is gadle.properties?
android/gradle.properties
Where is gadle.properties?
android/gradle.properties
Thx Sir
sunilpatidhar thank you so much
It causes this error for the
RN 0.60.
You can solve this by following,npm i jetifier npx jetifyfixed it for me on
RN 0.60.Have a good day.
This worked but folks...this makes zero sense how can we close our development machines start them back up and everything breaks? I had the same issue as the OP and thankfully @Harsh2402 worked for me.
This has ruined my confidence in Android Studio on Windows 10 I cannot justify the downtime in productivity.
sunilpatidar's answer worked for me adding 2 lines to gradle.properties under android android.useAndroidX=true android.enableJetifier=true run following command npm install -g jetifier npx jetify
very good! It worked
This issue was not active for some time so I'm closing it.
If you need further help please reply.
Most helpful comment
adding 2 lines to gradle.properties under android
android.useAndroidX=true
android.enableJetifier=true
run following command
npm install -g jetifier
npx jetify