Driftt/drift-sdk-android

App Crashing on opening Chat Conversation Detail screen

Closed this issue · 12 comments

Hello,

I am using driftt version 1.1.1
I am trying to open an existing conversation but getting this Fatal exception

07-24 12:41:52.186 22572-22572/ E/AndroidRuntime: FATAL EXCEPTION: main
    Process: , PID: 22572
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.ArrayList.isEmpty()' on a null object reference
        at drift.com.drift.d.d.a(MessageManager.java:176)
        at drift.com.drift.d.d$4.a(MessageManager.java:292)
        at drift.com.drift.d.d$4.a(MessageManager.java:286)
        at drift.com.drift.h.g$1.a(MessagesWrapper.java:37)
        at b.g$a$1$1.run(ExecutorCallAdapterFactory.java:70)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:5942)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

I am using Proguard in my project like this

minifyEnabled true
shrinkResources true
debuggable true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

Do I have to add any class name from Driftt in my proguard file so that it doesn't obfuscate or remove it? Please suggest

Hello,

that certainly shouldn't happen, I wasn't able to reproduce your issue but I will keep trying. Is it in all conversations or just a particular one?

Thank you for the response

It is crashing on all the conversations, as soon as I start a new chat and send a single message it crashes with this Exception

07-24 23:20:27.141 21789-21789/a E/AndroidRuntime: FATAL EXCEPTION: main
    Process: , PID: 21789
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.ArrayList.isEmpty()' on a null object reference
        at drift.com.drift.d.d.a(MessageManager.java:176)
        at drift.com.drift.d.d$4.a(MessageManager.java:292)
        at drift.com.drift.d.d$4.a(MessageManager.java:286)
        at drift.com.drift.h.g$1.a(MessagesWrapper.java:37)
        at b.g$a$1$1.run(ExecutorCallAdapterFactory.java:70)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:5942)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

And when I try to open a chat from the conversations screen it crashes with the exception that I mentioned in my first comment.

I am using it via Gradle
implementation 'com.github.driftt:drift-sdk-android:v1.1.1'

any update? @eoinoconnell

Hi @akhatriST sorry for the delay, we were able to reproduce the issue and it seems to be related to proguard as you suggested, we are working on it and will get back to you asap

Great, looking forward to get the fix from you guys

Hi, We're still working on this and will have a release out soon with a consumer pro guard file to deal with this on our end, while you wait could you try adding -keep class drift.com.drift.model.** { *; } to your proguard file?

Sure, will try and let you know whether it works or not

@eoinoconnell -keep class drift.com.drift.model.** { *; } This seems to prevent the app from crashing

Thanks

@eoinoconnell Wanted to know one thing though it is not related to the crash,

Is there a way to send some metadata related to the user when the chat session is started? like phone manufacturer, model, etc... or any random information

Hi @akhatriST, version 1.1.2 is now live with a consumer pro guard file that should help you. With regard sending user metadata that is not something we currently support I'm afraid

Thanks for releasing the fix. But I am afraid I won't be able to use this fix because I have a requirement where I have to pass some metadata to the agent which unfortunately can't be done in Driftt.
Guess I 'll have to find some other services that provide such support.