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.

Error: Cannot find symbol `RCTModernEventEmitter`

See original GitHub issue

Environment

System: OS: macOS 11.6 CPU: (16) x64 Intel® Core™ i9-9980HK CPU @ 2.40GHz Memory: 3.77 GB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.18.0 - /var/folders/21/5xmhgtlx4bj0gthrmm8tm3zc0000gq/T/yarn–1666283778817-0.44241538565301974/node Yarn: 1.22.19 - /var/folders/21/5xmhgtlx4bj0gthrmm8tm3zc0000gq/T/yarn–1666283778817-0.44241538565301974/yarn npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm Watchman: 2022.09.12.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/eueddemkim-new/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7784292 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

My Android build setting is:

    buildToolsVersion = "30.0.2"
    minSdkVersion = 21
    compileSdkVersion = 30
    targetSdkVersion = 30
    supportLibVersion = "30.0.0"

My testing device is Pixel 3XL on Android 12.

Description

I’m trying to upgrade the library from 4.2.4 to 4.3.2. It works okay on iOS, but on Android, it returns errors on build:

Error happens on Android build:
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderEvent.java:13: error: cannot find symbol
import com.facebook.react.uimanager.events.RCTModernEventEmitter;
                                          ^
  symbol:   class RCTModernEventEmitter
  location: package com.facebook.react.uimanager.events
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderEvent.java:51: error: cannot find symbol
  public void dispatchModern(RCTModernEventEmitter rctEventEmitter) {
                             ^
  symbol:   class RCTModernEventEmitter
  location: class ReactSliderEvent
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingCompleteEvent.java:13: error: cannot find symbol
import com.facebook.react.uimanager.events.RCTModernEventEmitter;
                                          ^
  symbol:   class RCTModernEventEmitter
  location: package com.facebook.react.uimanager.events
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingCompleteEvent.java:49: error: cannot find symbol
    public void dispatchModern(RCTModernEventEmitter rctEventEmitter) {
                               ^
  symbol:   class RCTModernEventEmitter
  location: class ReactSlidingCompleteEvent
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingStartEvent.java:13: error: cannot find symbol
import com.facebook.react.uimanager.events.RCTModernEventEmitter;
                                          ^
  symbol:   class RCTModernEventEmitter
  location: package com.facebook.react.uimanager.events
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingStartEvent.java:49: error: cannot find symbol
    public void dispatchModern(RCTModernEventEmitter rctEventEmitter) {
                               ^
  symbol:   class RCTModernEventEmitter
  location: class ReactSlidingStartEvent
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderEvent.java:18: error: ReactSliderEvent is not abstract and does not override abstract method dispatch(RCTEventEmitter) in Event
public class ReactSliderEvent extends Event<ReactSliderEvent> {
       ^
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderEvent.java:50: error: method does not override or implement a method from a supertype
  @Override
  ^
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingCompleteEvent.java:18: error: ReactSlidingCompleteEvent is not abstract and does not override abstract method dispatch(RCTEventEmitter) in Event
public class ReactSlidingCompleteEvent extends Event<ReactSlidingCompleteEvent> {
       ^
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingCompleteEvent.java:48: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingStartEvent.java:19: error: ReactSlidingStartEvent is not abstract and does not override abstract method dispatch(RCTEventEmitter) in Event
public class ReactSlidingStartEvent extends Event<ReactSlidingStartEvent> {
       ^
/Users/eueddemkim-new/Documents/workspace/mahalo/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingStartEvent.java:48: error: method does not override or implement a method from a supertype
    @Override
    ^

Reproducible Demo

Use latest library, install the app on Android 12 device and run.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
okwasniewskicommented, Nov 4, 2022

I had the same issue with android. If for some reason you cannot update the react-native version, you can undo the changes specified here and it worked for me!

Also please let me know if you think this would have any side effects.

This shouldn’t have any side effects if you are not using new architecture, and guessing by your react native version you are not 😄 So changing this is safe.

0reactions
fizawisedvcommented, Nov 8, 2022

@eueddem @fizawisedv Did you folks checked with the latest Slider version v4.3.3? It has the RCTModernEventEmitter usage removed so maybe this could resolve your error? Please try with the latest Slider version and let me know.

Build fails for me with v4.3.3 as well. Showing below error for the event files:

ReactSliderEvent.java:18: error: ReactSliderEvent is not abstract and does not override abstract method dispatch(RCTEventEmitter) in Event public class ReactSliderEvent extends Event<ReactSliderEvent> { ^

For now, getting back to v4.3.2 without the RCTModernEventEmitter

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: cannot find symbol import com.facebook.react.bridge ...
My guess is that the ColorPropConverter file has gone missing...if so, why it got deleted and how can I restore it? Thanks for...
Read more >
How to Resolve The Cannot Find Symbol Error in Java - Rollbar
The cannot find symbol error refers to a situation where the Java compiler is unable to find the symbol associated with a given...
Read more >
What Causes “Cannot find symbol” Compilation Error in Java?
Java Cannot find symbol error is a commonly occurring error in the Java compilation process. Find out its causes and ways to resolve...
Read more >
The "Cannot find symbol" Compilation Error - Baeldung
The “cannot find symbol” error comes up mainly when we try to use a variable that's not defined or declared in our program....
Read more >
Error: cannot find symbol - Code with Mosh Forum
I just started learning, and I follow what the video said to type out all the code, but I got the error message...
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