@@ -609,3 +609,51 @@ First, to enable the **New Architecture**:
6096091. Open the ` android / gradle .properties ` file
6106102. Scroll down to the end of the file and switch the ` newArchEnabled ` property from ` false ` to ` true ` .
611611
612+ Then, to manually link your new TurboModule:
613+
614+ 1. Open the ` NewArchitecture / android / app / build .gradle ` file and update the file as it follows:
615+ ` ` ` diff
616+ " PROJECT_BUILD_DIR=$buildDir" ,
617+ " REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid" ,
618+ - " REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
619+ + " REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build" ,
620+ + " NODE_MODULES_DIR=$rootDir/../node_modules/"
621+ cFlags " -Wall" , " -Werror" , " -fexceptions" , " -frtti" , " -DWITH_INSPECTOR=1"
622+ cppFlags " -std=c++17"
623+ ` ` `
624+ 1. Open the ` NewArchitecture/android/app/src/main/jni/Android .mk ` file and update the file as it follows:
625+ ` ` ` diff
626+ # If you wish to add a custom TurboModule or Fabric component in your app you
627+ # will have to include the following autogenerated makefile.
628+ # include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
629+ +
630+ + include $(NODE_MODULES_DIR)/rtn-calculator/android/build/generated/source/codegen/jni/Android.mk
631+ include $(CLEAR_VARS)
632+ ` ` `
633+ 1. In the same file above, go to the ` LOCAL_SHARED_LIBRARIES ` setting and add the following line:
634+ ` ` ` diff
635+ libreact_codegen_rncore \
636+ + libreact_codegen_RTNCalculator \
637+ libreact_debug \
638+ ` ` `
639+ 1. Open the ` NewArchitecture/android/app/src/main/jni/MainApplicationModuleProvider .cpp ` file and update the file as it follows:
640+ 1. Add the import for the calculator:
641+ ` ` ` diff
642+ #include <answersolver.h>
643+ + #include <RTNCalculator.h>
644+ ` ` `
645+ 1. Add the following check in the ` MainApplicationModuleProvider ` constructor:
646+ ` ` ` diff
647+ // auto module = samplelibrary_ModuleProvider(moduleName, params);
648+ // if (module != nullptr) {
649+ // return module;
650+ // }
651+
652+ + auto module = RTNCalculator_ModuleProvider(moduleName, params);
653+ + if (module != nullptr) {
654+ + return module;
655+ + }
656+
657+ return rncore_ModuleProvider(moduleName, params);
658+ }
659+ ` ` `
0 commit comments