React Native Android:方法不会覆盖或实现超类型的方法 [英] React Native Android: Method does not override or implement a method from a supertype

查看:424
本文介绍了React Native Android:方法不会覆盖或实现超类型的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将react-native-fbsdk添加到我的react本机项目中,并使其在iOS上正常运行.但是在android方面,我无法获得构建项目的机会.尝试编译react-native-fbsdk时,我打的是:方法不会覆盖或实现超类型的方法"

I've added react-native-fbsdk to my react native project and have it building fine on iOS. But on the android side, I can't get gradle to build the project. When trying to compile react-native-fbsdk, I'm hitting: "method does not override or implement a method from a supertype"

21:41:11.863 [INFO] [org.gradle.api.internal.tasks.compile.JdkJavaCompiler] Compiling with JDK Java compiler API.
21:41:12.100 [ERROR] [system.err] /Users/joncursi/Sites/joncursi/redbirdNative/node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java:61: error: method does not override or implement a method from a supertype

在react-native-fbsdk中指向以下代码段:

Which points to the following code snippet within react-native-fbsdk:

@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}

当我删除@Override时,该错误的特定实例消失了,但是我在另一个模块(例如react-native-image-picker)中遇到了相同的错误:

When I delete @Override, this particular instance of the error goes away, but I hit the same error in another module such as react-native-image-picker:

:react-native-image-picker:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/Users/joncursi/Sites/joncursi/redbirdNative/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerPackage.java:34: error: method does not override or implement a method from a supertype
  @Override
  ^
1 error

我怀疑这与我的本地设置有关.关于这里可能有什么问题的任何想法?

I suspect this to be an issue with my local setup. Any ideas on what could be wrong here?

推荐答案

错误非常模糊(而且imo在本机发布流程中有些混乱).

The error is very vague (and imo a bit of a mess up in the react native release flow).

React-native 0.47.0进行了重大更改,这意味着lib必须修补其代码.

React-native 0.47.0 had a breaking change that meant libs had to patch their code.

删除未使用的createJSModules调用(ce6fb33、53d5504)-

我的猜测是,您只需要更新显示此错误的库,否则提交PR.

My guess is that you just have to update the libraries for which this error shows up, and otherwise submit a PR.

这是修复它的lib的示例: https://github.com/rebeccahughes/react-native-device-info/pull/191/files

Here's an example of a lib fixing it: https://github.com/rebeccahughes/react-native-device-info/pull/191/files

更新:

您正在等待的PR在这里: https://github. com/facebook/react-native-fbsdk/pull/354

The PR you're waiting for is here: https://github.com/facebook/react-native-fbsdk/pull/354

这篇关于React Native Android:方法不会覆盖或实现超类型的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆