gradle react-native-share错误找不到符号上下文,RECEIVER_EXPORTED

n9vozmp4  于 12个月前  发布在  React
关注(0)|答案(1)|浏览(310)

当我安装react-native-share并尝试启动我的项目时,我得到了这个错误。我不知道如何解决它。下面是具体的错误:https://i.stack.imgur.com/PAONh.png
Gradle 7.3.3
React native 0.68.2
完整错误描述:

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

字符串
完整错误描述:https://i.stack.imgur.com/HC3Wa.png
我试图重新安装库,但它不工作

kmpatx3s

kmpatx3s1#

我在使用版本10.0.1时也遇到了这个错误,这个错误也出现在9.0.1上,我通过降级**“react-native-share”:“8.0.0”**修复了它。

相关问题