Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Android autolinking not working #29

Open
brianephraim opened this issue Oct 1, 2019 · 1 comment
Open

Android autolinking not working #29

brianephraim opened this issue Oct 1, 2019 · 1 comment

Comments

@brianephraim
Copy link

RN 0.60.5
@brandingbrand/react-native-leanplum 4.0.0

I get the following error when building for dev on Android:

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

FAILURE: Build failed with an exception.

I figured out a workaround by updating my react-native.config.js as the following:

module.exports = {
  dependencies: {
    '@brandingbrand/react-native-leanplum': {
      platforms: {
        android: {
          packageInstance: 'new RNLeanplumPackage(getApplication())'
        },
      },
    },
  },
};

Then the app builds on Android fine.

@lelumees
Copy link

Yeah I had the same issue.

Environment:
RN 0.59.9
@brandingbrand/react-native-leanplum 3.0.1

I did the modification in MainApplication.java by adding the getApplication() to package initialisation:

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNLeanplumPackage(getApplication()),
        ...
    );
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants