leegeunhyeok / react-native-zendesk-messaging

🗣️ Zendesk messaging SDK for React Native
https://www.npmjs.com/package/react-native-zendesk-messaging
MIT License
40 stars 12 forks source link

Crash on Zendesk initialization ANDROID #2

Closed dheeyi closed 1 year ago

dheeyi commented 1 year ago

...... buildToolsVersion = "30.0.2" minSdkVersion = 23 compileSdkVersion = 33 targetSdkVersion = 31 ndkVersion = "21.4.7075529" googlePlayServicesAuthVersion = "16.0.1" firebaseMessagingVersion = "21.1.0" androidXAnnotation = "1.1.0" androidXBrowser = "1.0.0" kotlin_version = "1.5.0" androidXCore = "1.5.0" } repositories {

    maven { url 'https://maven.fabric.io/public' }
    google()
    jcenter()
    mavenCentral()

}
dependencies {
    classpath('com.android.tools.build:gradle:7.2.0')

...........

I have this issue:

Caused by: android.view.InflateException: Binary XML file line #2 in com.ns412.naturallyslim.debug:layout/zma_screen_conversation: Binary XML file line #2 in com.ns412.naturallyslim.debug:layout/zma_screen_conversation: Error inflating class zendesk.messaging.android.internal.conversationscreen.ConversationScreenView Caused by: android.view.InflateException: Binary XML file line #2 in com.ns412.naturallyslim.debug:layout/zma_screen_conversation: Error inflating class zendesk.messaging.android.internal.conversationscreen.ConversationScreenView Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:852) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) at android.view.LayoutInflater.inflate(LayoutInflater.java:657) at android.view.LayoutInflater.inflate(LayoutInflater.java:532) at android.view.LayoutInflater.inflate(LayoutInflater.java:479) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195) at zendesk.messaging.android.internal.conversationscreen.ConversationActivity.onCreate(ConversationActivity.kt:113) at android.app.Activity.performCreate(Activity.java:8000) at android.app.Activity.performCreate(Activity.java:7984) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/AndroidRuntime: Caused by: java.lang.NoSuchMethodError: No direct method (Landroid/content/Context;)V in class Lcoil/decode/ImageDecoderDecoder; or its super classes (declaration of 'coil.decode.ImageDecoderDecoder' appears in /data/app/~~9UxvNDhBcJ9_TW0VDz_Z4Q==/com.ns412.naturallyslim.debug-wKT6rh4awd-N09DDRSbQVQ==/base.apk!classes6.dex) at zendesk.ui.android.internal.ImageLoaderFactory.getImageLoader$zendesk_ui_ui_android(ImageLoaderFactory.kt:71) at zendesk.ui.android.conversation.header.ConversationHeaderView.render(ConversationHeaderView.kt:85) at zendesk.messaging.android.internal.conversationscreen.ConversationScreenView.render(ConversationScreenView.kt:169) at zendesk.messaging.android.internal.conversationscreen.ConversationScreenView.(ConversationScreenView.kt:161) at zendesk.messaging.android.internal.conversationscreen.ConversationScreenView.(ConversationScreenView.kt:42) at zendesk.messaging.android.internal.conversationscreen.ConversationScreenView.(Unknown Source:11) ... 26 more

leegeunhyeok commented 1 year ago

Is this an issue that happens all the time?

same issue was reported at Zendesk community now. but this issue not reproduced in my environment.

can you share project(or demo) that has this issue?

nfquispe commented 1 year ago

I think the solution is increased the version of this zendesk.messaging:messaging-android to 2.8.0

The patch would be the following

`diff --git a/node_modules/@flashcoffee/react-native-zendesk-messaging/android/build.gradle b/node_modules/@flashcoffee/react-native-zendesk-messaging/android/build.gradle index 2efb5c0..4639c86 100644 --- a/node_modules/@flashcoffee/react-native-zendesk-messaging/android/build.gradle +++ b/node_modules/@flashcoffee/react-native-zendesk-messaging/android/build.gradle @@ -59,5 +59,5 @@ repositories { dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules

dheeyi commented 1 year ago

@nfquispe Works for me, thanks a lot

leegeunhyeok commented 1 year ago

@nfquispe it seems like you installed another package.

this repository is for react-native-zendesk-messaging package, not a @flashcoffee/react-native-zendesk-messaging. please check it. (not same build.gradle)

@dheeyi if you installed correct package, you can change SDK version like this. (docs: https://github.com/leegeunhyeok/react-native-zendesk-messaging/blob/master/docs/getting-started.md#android)

// Your root build.gradle
buildscript {
  ext {
    ...
    zendeskSdkVersion = "2.8.0" // default version is "2.3.0"
  }
}

by the way, always using latest version(as of 2023.03.30: 2.8.1) of SDK in ios now, but android doesn't (version fixed by default 2.3.0). I think need to bump up default version of android SDK, because latest version of sdks are has many changes and fixes(maybe this issue fixed too).

ajiehatajie commented 1 year ago

Any Update for this issue ?

zendeskSdkVersion = "2.11.0"

leegeunhyeok commented 1 year ago

https://github.com/leegeunhyeok/react-native-zendesk-messaging/pull/10 was merged.

release as 0.1.1 soon with some fixes.

leegeunhyeok commented 1 year ago

https://github.com/leegeunhyeok/react-native-zendesk-messaging/releases/tag/v0.1.1 released.

Default SDK version was bumped up

If you want change SDK version, follow Overriding SDK versions in docs. thanks :)