braze-inc / braze-react-native-sdk

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

[Bug]: Android build crash (Debug and Release) #263

Closed amitmehtacode closed 2 months ago

amitmehtacode commented 2 months ago

Which Platforms?

Android

Which React Native Version?

0.71.10

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

12.0.0

Repro Rate

100%

Steps To Reproduce

Example:

  1. import Braze from "@braze/react-native-sdk".
  2. Braze.changeUser("id")
  3. Run the app.

Expected Behavior

Android App Should not crash

Actual Incorrect Behavior

Android App get crash while opening the app Happening in all the versions

Verbose Logs

BrazeReactBridgeImpl.addListener
java.lang.NoSuchMethodError - No static method brazelog$default(Lcom/braze/support/BrazeLogger;Ljava/lang/Object;Lcom/braze/support/BrazeLogger$Priority;Ljava/lang/Throwable;Lkotlin/jvm/function

Additional Information

Fatal Exception: java.lang.RuntimeException: Could not invoke BrazeReactBridge.addListener
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
       at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
       at java.lang.Thread.run(Thread.java:1012)
MattWhiteTechno commented 2 months ago

Confirm. Observing this also...

java.lang.NoSuchMethodError: No static method brazelog$default(Lcom/braze/support/BrazeLogger;Ljava/lang/Object;Lcom/braze/support/BrazeLogger$Priority;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V in class Lcom/braze/support/BrazeLogger; or its super classes (declaration of 'com.braze.support.BrazeLogger'

marc-technocrat commented 2 months ago

It broke for me couple hours ago

jerielng commented 2 months ago

Hi, unfortunately, we're not able to reproduce this crash from our end with the steps provided. I noticed in the initial post, you mentioned that this is Happening in all the versions - to clarify, you mean that this is happening on all versions of the Braze React Native SDK?

Could you write in to our support team at support@braze.com with some of the following project details (along with anything else you are able to share):

bryanlogan commented 2 months ago

Are you updating the version of com.braze:android-sdk-ui yourself? You should just be using the version that ships with the wrapper.

https://www.braze.com/docs/developer_guide/platform_integration_guides/android/initial_sdk_setup/android_sdk_integration/#basic-integration

important: If you’re using a non-native Android SDK (for example, Flutter, Cordova, Unity, etc.), that SDK already has the android-sdk-ui dependency for the correct version of the Android SDK. Do not update that version manually.

amitmehtacode commented 2 months ago

@bryanlogan @jerielng Yesterday it was working fine and i am using "@braze/react-native-sdk": "^8.2.0", version. But Today I notice sudden crash on this version. I also try to updated to the latest version but still the issue is same.

bryanlogan commented 2 months ago

Do you have android-sdk-ui anywhere in your codebase?

amitmehtacode commented 2 months ago

yes @bryanlogan in app/build.gradle we have add this in

dependencies {
implementation "com.braze:android-sdk-ui:+"
}
bryanlogan commented 2 months ago

@amitmehtacode You don't need that. The react native library brings in the proper Android SDK. We specifically tell people to not do that here:

https://www.braze.com/docs/developer_guide/platform_integration_guides/android/initial_sdk_setup/android_sdk_integration/#basic-integration

amitmehtacode commented 2 months ago

@bryanlogan Thanks for the Help

marc-technocrat commented 2 months ago

In our codebase we had this which was causing the the crash.

dependencies {
implementation "com.braze:android-sdk-location:+"
}

Our dev notes indicate it was for braze location. Is anything needed for braze location for react native? We have the 11.0.0 sdk