简体   繁体   English

“UMNativeModulesProxy”本机模块不是通过 NativeModules 导出的吗? 反应本机 android

[英]The "UMNativeModulesProxy" native module is not exported through NativeModules ? React native android

The "UMNativeModulesProxy" native module is not exported through NativeModules; “UMNativeModulesProxy”本机模块不通过 NativeModules 导出; verify that @unimodules/react-native-adapter's native code is linked properly?验证@unimodules/react-native-adapter 的本机代码是否正确链接?

You have to add this block of code in MainApplication.java file您必须在 MainApplication.java 文件中添加此代码块

List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
        new ModuleRegistryAdapter(mModuleRegistryProvider)
      );
      packages.addAll(unimodules);
     return packages;

Add this code in the current block of ReactPackage code, or you can replace this complete block of code在当前 ReactPackage 代码块中添加此代码,或者您可以替换此完整代码块

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM