-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question : Following the guide from reactnative native modules for Android throws error #3075
Comments
And also please tell us where to write the Java files for the native modules. Can they be siblings to MainActivity.java.. ? Thanks |
You need to implement the class AnExampleReactPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(
new WebSocketModule(reactContext),
new IntentModule(reactContext)
);
}
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Arrays.asList();
}
} I don't think the package for the native modules really matters. As long as you can access the package class in the |
Worked Perfectly .. Thank you very much !! |
For those, visiting this link for similar issues, some more info. I realised that your react package should be added in addition to the MainReactPackage. So it goes like this mReactInstanceManager = ReactInstanceManager.builder() |
well i am getting
error while implementing ReactPackage interface... ReactPackage does not contain such method I've seen |
Hi devs.
In process of creating Native modules for Android (Following what is mentioned in https://facebook.github.io/react-native/docs/native-modules-android.html#content)
I get this error while app compilation .
..src/main/java/com/azharapp/AnExampleReactPackage.java:15:error: AnExampleReactPackage is not abstract and does not override abstract method createViewManagers(ReactApplicationContext) in ReactPackage
Thanks.
The text was updated successfully, but these errors were encountered: