Sentry-react-native: Android build failed

Created on 15 May 2018  ·  8Comments  ·  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

v8.11.1
6.0.1
[email protected]
[email protected]
[email protected]

node_modules/react-native-sentry/android/src/main/java/io/sentry/RNSentryModule.java:262: error: incompatible types: ReadableArray cannot be converted to ReadableNativeArray
                addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), stacktrace.getArray("frames"));

I have following issue:

Failed to build android apk

Steps to reproduce:

  • run on termial react-native run-android

Actual result:
node_modules/react-native-sentry/android/src/main/java/io/sentry/RNSentryModule.java:262: error: incompatible types: ReadableArray cannot be converted to ReadableNativeArray
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), stacktrace.getArray("frames"));

Expected result:

  • build succeed

Most helpful comment

@m-vdb Check the link in my comment above. The reason your build was breaking was because of a bad react-native dependency that was uploaded to the maven / jcenter repositories. The bad dependency caused the older Sentry versions to attempt to be built using newer libraries that didn't have backwards compatibility support for the older Sentry versions. Now that the bad react-native dependency has been removed from maven / jcenter this error should be resolved.

All 8 comments

Was just about to open this very same issue. I am on [email protected] and [email protected], I thought it might have to do something wit the version so I updated the library to 0.36 and I get a successful build but cannot do anything because I get React Native version mismatch so it seems that the new version of this library is only compatible with RN 55? if so the readme needs to be updated.

Update

I was completely wrong about the RN version mismatch. I did have to do an extra step tho, in the android/app/build.gradle I added (for my RN version case) compile ('com.facebook.react:react-native:0.52.0') { force = true } and with [email protected] it builds and works perfect again, it seems that the issue was solved in 0.34.1 https://github.com/getsentry/react-native-sentry/issues/354 . So just update the library and you should be good to go.

@RobPando
I saw that hack, but when you'll upgrade react-native version you'll have to manually update this number as well... could be fix for now but not as a solution.

Updating to 0.36.0 fixed the build issue for me:

v6.11.2
5.3.0
<myproject>
├── [email protected]
├── [email protected]
└── [email protected]

But I get the same version mismatch issue... The hack works but it is definitely a hack and this will be an issue when upgrading RN versions.

It seems like it's trying to compile the react-native-sentry projects using a different React-Native version than what is currently installed in the node_modules folder.

I am on RN v0.51 as well. I haven't done an npm install of react-native-sentry since December. The build worked fine yesterday and breaks today.

Looks like this is an issue with the Maven repository, as discussed here

So this issue is not really related to Sentry, more like react-native / gradle itself.
Please use a version > 0.34.1 which should fix this issue.

@HazAT why do you say it fixes the issue?

@m-vdb Check the link in my comment above. The reason your build was breaking was because of a bad react-native dependency that was uploaded to the maven / jcenter repositories. The bad dependency caused the older Sentry versions to attempt to be built using newer libraries that didn't have backwards compatibility support for the older Sentry versions. Now that the bad react-native dependency has been removed from maven / jcenter this error should be resolved.

thanks! Don't why I didn't see that. I especially read this comment that explains the issue: https://github.com/facebook/react-native/issues/13094#issuecomment-389568018

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brainbicycle picture brainbicycle  ·  3Comments

kenobi91 picture kenobi91  ·  3Comments

dht picture dht  ·  3Comments

JonasBAJ picture JonasBAJ  ·  3Comments

sercanov picture sercanov  ·  3Comments