react-native-share error cannot find symbol Context.RECEIVER_EXPORTED

753 views Asked by At

When i install react-native-share and try to start my project i get this error. I don't know how to solve it. Here's specifically the error: https://i.stack.imgur.com/PAONh.png

Gradle 7.3.3

React native 0.68.2

Full error description:

Task :react-native-share:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
274 actionable tasks: 23 executed, 251 up-to-date
C:\Work2\itlg-weiv-mobile\node_modules\react-native-share\android\src\main\java\cl\json\social\TargetChosenReceiver.java:50: error: cannot find symbol
                context.registerReceiver(sLastRegisteredReceiver, new IntentFilter(sTargetChosenReceiveAction), Context.RECEIVER_EXPORTED);           
                                                                                                                       ^                              
  symbol:   variable RECEIVER_EXPORTED                                                                                                                
  location: class Context                                                                                                                             
Note: Some input files use or override a deprecated API.                                                                                              
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-share:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 3s

Full error description: https://i.stack.imgur.com/HC3Wa.png

I tried to reinstall the library but it didn't work

1

There are 1 answers

0
Bilal Yaqoob On

I was also getting this error while using version 10.0.1, this error also came on 9.0.1, I fixed it by downgrading "react-native-share": "8.0.0".