方法不会覆盖或实现超类型的方法-Reactnative

时间:2018-07-20 05:03:09

标签: java android react-native realm

我试图通过运行react-native run-android在Android模拟器上运行我的react native应用,它会带来此错误RealmReactPackage.java:18: error: method does not override or implement a method from a supertype @Override ^

请引起此错误的原因

RealmReactPackage.java

package io.realm.react;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Collections;
import java.util.List;

public class RealmReactPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    return Collections.<NativeModule>singletonList(new RealmReactModule(reactContext));
}

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

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
}

1 个答案:

答案 0 :(得分:0)

com.facebook.react.ReactPackage不包含createJSModules()方法。您不应使用@Override对其进行注释。