Sentry-react-native: Upgraded project to React Native 0.56. Sentry build fails on Android "actual and formal argument lists differ in length"

Created on 11 Oct 2018  ·  7Comments  ·  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

_Platform:_

  • [ ] iOS
  • [x] Android

Output of node -v && npm -v && npm ls --prod --depth=0

v9.3.0
5.5.1
/Users/me
└── (empty)

Config:

Sentry.config('https://[email protected]/...' ).install()

I have following issue:

Building for Android returns this error:

Error:(53, 9) error: constructor RNSentryPackage in class RNSentryPackage cannot be applied to given types;
required: no arguments
found: MainApplication
reason: actual and formal argument lists differ in length

Steps to reproduce:
Upgrade project to React Native 0.56.1

MainApplication.java contains

        new RNNotificationsPackage(MainApplication.this),

Actual result:
Build error

Expected result:
Successful build

Most helpful comment

@cihati

Remove the argument and simply call

new RNSentryPackage() 

All 7 comments

The RNSentryPackage class doesn't have a constructor:
https://github.com/getsentry/react-native-sentry/blob/master/android/src/main/java/io/sentry/RNSentryPackage.java#L14

Somehow either the updated versions of RN 0.56, Gradle 4.6, or Android SDK 28.x have removed default constructors. Not sure exactly what it is, but something involving constructors has changed.

This is actually a bug, I will release a new version tomorrow with a fix for this.

@peacechen Can you try to upgrade to 0.39.1 and see if the error is gone?

Yes it's working great. Thanks @HazAT

@HazAT I am still having this issue:

> Task :app:compileDebugJavaWithJavac FAILED
/Users/cihat/fatlama/mobile/android/app/src/main/java/com/fat_lama/MainApplication.java:58: error: constructor RNSentryPackage in class RNSentryPackage cannot be applied to given types;
            new RNSentryPackage(MainApplication.this),
            ^
  required: no arguments
  found: MainApplication
  reason: actual and formal argument lists differ in length
Note: /Users/cihat/fatlama/mobile/android/app/src/main/java/com/fat_lama/MainApplication.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I'm using React Native 0.57.5 and react-native-sentry 0.39.1

any ideas?

@cihati

Remove the argument and simply call

new RNSentryPackage() 

Yes, this did solve the issue -- thanks @peacechen and @HazAT =)

Was this page helpful?
0 / 5 - 0 ratings