Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructor BraintreePackage in class BraintreePackage cannot be applied to given types #11

Open
asciiman opened this issue Nov 3, 2016 · 4 comments

Comments

@asciiman
Copy link

asciiman commented Nov 3, 2016

:app:compileDebugJavaWithJavac
/Users/asciiman/Documents/Code/GoStudent/bt2/android/app/src/main/java/com/bt2/MainApplication.java:30: error: constructor BraintreePackage in class BraintreePackage cannot be applied to given types;
          new BraintreePackage()
          ^
  required: Context
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error

The readme says to add new BraintreePackage() to MainActivity.java, but the constructor looks like public BraintreePackage(Context activityContext).

@alienxp03
Copy link

Can you paste your related MainApplication.java codes? And which React Native version are you using? I'm currently on react 15.3.1 and react-native 0.32.0, and it works fine based on the readme syntax

@asciiman
Copy link
Author

asciiman commented Nov 4, 2016

package com.bt2;

import android.app.Application;
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

import com.surialabs.rn.braintree.BraintreePackage;
import android.content.Intent;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

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

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

  @Override
  public ReactNativeHost getReactNativeHost() {
      return mReactNativeHost;
  }
}

RN 0.36.1 and React 15.3.2

@kaberibasu
Copy link

@asciiman I am facing the same issue, have you found any solution?

@chinloongtan
Copy link
Contributor

You might want to look at this package instead.
https://github.com/kraffslol/react-native-braintree-xplat
Its a merged and maintained version of this package with equivalent implementation for iOS.

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

No branches or pull requests

4 participants