react-native-tts icon indicating copy to clipboard operation
react-native-tts copied to clipboard

How to remove Warn new NativeEventEmitter ?

Open praptoherlambang opened this issue 2 years ago • 5 comments

this is so annoying.

new NativeEventEmitter() was called with a non-null argument without the required addListener method. new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

how fix this issues guys..

praptoherlambang avatar Jan 23 '23 06:01 praptoherlambang

Same issue

celciusjj avatar Feb 23 '23 17:02 celciusjj

node_modules/react-native-tts/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java

Just add this.

    @ReactMethod
    public void addListener(String eventName) {
        // Keep: Required for RN built in Event Emitter Calls.
    }

    @ReactMethod
    public void removeListeners(double count) {
        // Keep: Required for RN built in Event Emitter Calls.
    }

Ref this PR: https://github.com/invertase/react-native-firebase/pull/5616/files#diff-c887076b0c80d540aed1bfbb472cc8f20516634e8e72d53014c65d690bba4fb1

vito-mish avatar Feb 26 '23 06:02 vito-mish

I tried to 'just' add the provided code snippets inside node_modules/react-native-tts/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java

but when running npx react-native run-android I get the following error:

BUILD FAILED in 7s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
D:\Development\MobileApps\AwesomeProject\node_modules\react-native-tts\android\src\main\java\net\no_mad\tts\TextToSpeechModule.java:531: error: class, interface, or enum expected
    public void addListener(String eventName) {
           ^
D:\Development\MobileApps\AwesomeProject\node_modules\react-native-tts\android\src\main\java\net\no_mad\tts\TextToSpeechModule.java:536: error: class, interface, or enum expected
    public void removeListeners(double count) {
           ^
2 errors

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-tts:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Could you clarify a bit more? As the PR is a whole other file than the file you mention?!

1NoobDev avatar May 23 '23 20:05 1NoobDev

I can't find this java file inside android folder, is there another fix?

syednomishah avatar Jun 24 '23 05:06 syednomishah

I can't find this java file inside android folder, is there another fix?

it's inside node_modules folder. if you're using VS Code,

CTRL + P > Paste node_modules/react-native-tts/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java > Enter

haiffy420 avatar Mar 21 '24 02:03 haiffy420