jpush / jshare-react-native

https://docs.jiguang.cn
MIT License
105 stars 28 forks source link

JSharePackage error with RN 0.61.5 #141

Open 42997455 opened 4 years ago

42997455 commented 4 years ago

When I try to run react-native run-android , got this error:

.../android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:79: error: constructor JSharePackage in class JSharePackage cannot be applied to given types;
      new JSharePackage(),
      ^
  required: boolean,boolean
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error

I find it caused by the RN 0.61.5 is auto-link, the auto generated class PackageList.java is as below:

  public ArrayList<ReactPackage> getPackages() {
    return new ArrayList<>(Arrays.<ReactPackage>asList(
      new MainReactPackage(mConfig),
      new JPushPackage(),
      new JSharePackage(),
      ...
   ));
  }

The JSharePackage should be JSharePackage(boolean, boolean), but the auto generated code is without parameter, could you please help with this issue? Thanks!

mylesshie commented 4 years ago

same error

mylesshie commented 4 years ago

node_modules/jshare-react-native/android/src/main/java/..../JsharePackage.java文件中添加如下代码。

public JSharePackage() { Logger.SHUTDOWNTOAST = false; Logger.SHUTDOWNLOG = false; }

mokai commented 2 years ago

react-native.config.js

module.exports = {
  dependencies: {
    'jshare-react-native': {
      platforms: {
        android: {
          packageInstance: 'new JSharePackage(false, false)',
        },
      },
    },
  },
};