braze-inc / braze-react-native-sdk

Public repo for the Braze React Native SDK
https://www.braze.com
Other
64 stars 82 forks source link

[Bug]: com.braze:android-sdk-location:+ causes crash #264

Open marc-technocrat opened 2 weeks ago

marc-technocrat commented 2 weeks ago

Which Platforms?

Android

Which React Native Version?

0.73.9

Which @braze/react-native-sdk SDK version?

11.0.0

Repro Rate

100%

Steps To Reproduce

In app/build.gradle include

implementation "com.braze:android-sdk-location:+"
  1. Run the app.
  2. Crashes before RN is injected

Expected Behavior

It should boot the app

Actual Incorrect Behavior

Crashes on launch

Verbose Logs

No response

Additional Information

Can see that this was required for Braze Location and geofence functionality. https://www.braze.com/docs/developer_guide/platform_integration_guides/android/changelog/#2410 Team has steadily updated Braze.

amitmehtacode commented 2 weeks ago

you need to remove this

implementation "com.braze:android-sdk-ui:+"

marc-technocrat commented 2 weeks ago

@amitmehtacode don't have that line in our code

bryanlogan commented 2 weeks ago

@marc-technocrat We'll look into how to make the location match the shipped version better. For now, can you set the location version to the Android SDK version that's specified in the release notes of the Braze React Native SDK?

marc-technocrat commented 2 weeks ago

@bryanlogan Which version? We have the 11.0.0 react native sdk.

This is working implementation "com.braze:android-sdk-location:31.1.0"

Would this be a temporary solution until you fix it on your backend?

bryanlogan commented 2 weeks ago

Yes, that would be a temporary solution.

radixdev commented 2 weeks ago

Hello @marc-technocrat et al,

For each SDK wrapper, we do compatibility testing with each released version of the core native (android and iOS) Braze SDKs. You can see that version here. Until we make an official release of the upstream wrapper (in this case React), we do not recommend using a different version of the underlying native SDK.

However, in order to fix your crash and be able to use the location library, we recommend adding this to your root level build.gradle file.

allprojects {
    configurations.all {
        resolutionStrategy {
            force 'com.braze:android-sdk-ui:+'
        }
    }
}

The cause of the crash is that our wrapper dependency is compiled against a different version than the latest, which is what the + in implementation "com.braze:android-sdk-location:+" is doing. This fix is merely telling Gradle that all transitive dependencies of your app should be using the same version, which is your case would be "com.braze:android-sdk-location:+". Our location SDK pulls in com.braze:android-sdk-ui as a dependency.

Please let us know if this fixes your issue, Julian

marc-technocrat commented 2 weeks ago

@radixdev Going forward is the intention to no longer require "com.braze:android-sdk-location:+"? If not it should be. The sdk should fully manage the native dependencies. This a pretty poor experience to have the libraries randomly crash one day when you guys push an update. It's not a proper react-native-sdk when native dependency management is required and unreliable.

radixdev commented 2 weeks ago

Hi @marc-technocrat ,

That's excellent feedback and I've taken it to the team for review. I'll update this issue once we have more details/release date.