Skip to content

Problem enabling JSI using the new android/app structure on react-native 0.71.5 #1544

Description

@lucaswitch

App does not build when JSI is enabled using the new architecture.

My JSI modules in MainApplication.java looks like following:


 private final ReactNativeHost mReactNativeHost =
    new DefaultReactNativeHost(this) {
      @Override
      public boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
      }

      @Override
      protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
        List<ReactPackage> packages = new PackageList(this).getPackages();
        // Packages that cannot be autolinked yet can be added manually here, for example:
        // packages.add(new MyReactNativePackage());
        return packages;
      }


    @Override
    protected JSIModulePackage getJSIModulePackage() {
      return new JSIModulePackage() {
         @Override
         public List<JSIModuleSpec> getJSIModules(
           final ReactApplicationContext reactApplicationContext,
           final JavaScriptContextHolder jsContext
         ) {
           final List<JSIModuleSpec> specs = new ArrayList<>();
           specs.addAll(new WatermelonDBJSIPackage().getJSIModules(reactApplicationContext, jsContext));
           // ⬅️ add more JSI packages here by conventions above

           return specs;
         }
       };
     }

      @Override
      protected String getJSMainModuleName() {
        return "index";
      }

      @Override
      protected boolean isNewArchEnabled() {
        return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
      }

      @Override
      protected Boolean isHermesEnabled() {
        return BuildConfig.IS_HERMES_ENABLED;
      }
    `};`

The following error:
image

Also for future versions the folder android/app/newarchitecture is removed.

"react-native": "0.71.5"
"@nozbe/watermelondb": "0.25.5"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions