From 0b734f628303910c60a8af6dd100f06cb44f4aeb Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Sun, 29 Sep 2019 19:40:24 -0700 Subject: [PATCH] improve error message in NativeModuleRegistryBuilder.java (#26467) Summary: ## Motivation I have seen a spike in users reporting this error. Unfortunately I did not receive any repros that would confirm this, but my hypothesis is that they ran into situation when `new XYZPackage()` was present in `getPackages()` method and then the CLI kicked in with autolinking and they were left with this incomplete error. someone more knowledgeable of autolinking should review this. Pull Request resolved: https://github.com/facebook/react-native/pull/26467 Differential Revision: D17661242 Pulled By: cpojer fbshipit-source-id: 63dfcd85a0d41d85a0dd52f84ab16cb7ceb64ba2 --- .../java/com/facebook/react/NativeModuleRegistryBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java index 9107a62d98e..ae1b8d1a84b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java @@ -52,7 +52,8 @@ public class NativeModuleRegistryBuilder { + name + " tried to override " + existingNativeModule.getClassName() - + ". Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true"); + + ". Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true. " + + "This error may also be present if the package is present only once in getPackages() but is also automatically added later during build time by autolinking. Try removing the existing entry and rebuild."); } mModules.remove(existingNativeModule); }