helpcrunch / android-sdk-demo

Public demo for HelpCrunch Android SDK
Apache License 2.0
9 stars 1 forks source link

HelpCrunch.showChatScreen() fails with IllegalStateException: Application id not found #73

Closed yaroslav-v closed 1 year ago

yaroslav-v commented 1 year ago

Hi!

The latest versions 3.2.7, 3.2.8 and 3.3.0 have an issue with showChatScreen(). After the call to HelpCrunch.showChatScreen() it fails with an error IllegalStateException: Application id not found.

The previous version 3.2.6 works just fine, after I change it to 3.2.7, or any other version after this one, the issue occurs. The initialization status message stays the same in all cases.

Here is the full log:

HCLog  I  HelpCrunch initialization successful
...
HCLog  E  java.lang.IllegalStateException: Application id not found
   at com.helpcrunch.library.oc.a(Repository.kt:1901)
   at com.helpcrunch.library.ui.screens.main.a$c.invokeSuspend(HelpCrunchMainViewModel.kt:3)
   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
   at android.os.Handler.handleCallback(Handler.java:942)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loopOnce(Looper.java:201)
   at android.os.Looper.loop(Looper.java:288)
   at android.app.ActivityThread.main(ActivityThread.java:7872)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Environment: a default Android emulator API 33 with Google Play

nostra13 commented 1 year ago

Maybe my issue is connected to this. I have "empty chat screen" on 3.2.7+ on some devices (Samsung One (Android 13), Samsung A52 (Android 11), Xiaomi Redmi (Android 10)) but okay on OnePlus 6 (Android 11). I can write in text field and send any message but it goes nowhere and screen remains empty.

Screenshot_20230505-145752_Eleven

yaroslav-v commented 1 year ago

Maybe my issue is connected to this. I have "empty chat screen" on 3.2.7+ on Samsung devices. I can write in text field and send any message but it goes nowhere and screen remains empty.

Screenshot_20230505-145752_Eleven

Yep, that's exactly how it looks in my case too.

TalbotGooday commented 1 year ago

Hi! Thanks for reporting! That's weird. Can you please provide some more information about it? Does the error appear after upgrading from previous versions to the 3.3.0? Is this bug reproduced in the demo app?

TalbotGooday commented 1 year ago

The only scenario I see of this error is that you didn't initialize the SDK before you opened the chat. And it has absolutely nothing to do with the version of the SDK. I strongly recommend to initialize the SDK in the application Perhaps you know other scenarios. I would be glad if you inform me about them :)

yaroslav-v commented 1 year ago

The only scenario I see of this error is that you didn't initialize the SDK before you opened the chat. And it has absolutely nothing to do with the version of the SDK. I strongly recommend to initialize the SDK in the application Perhaps you know other scenarios. I would be glad if you inform me about them :)

Hi!

Well, as I wrote earlier, the previous version 3.2.6 works just fine. The only change I made is the version of HelpCrunch SDK. If I update it to 3.2.7, or any other version after this one, the issue occurs.

The initialization message stays the same in all cases and it clearly states that SDK is initialized: HCLog I HelpCrunch initialization successful

yaroslav-v commented 1 year ago

I've spent some more time to locate the cause of the issue.

The problem is that HelpCrunch.isInitialized() returns incorrect status starting from v3.2.7. I use this method to check the initialization status of SDK and do or skip initialization according to the return.

As stated in its description "Returns current initializations state / @return true if initialize method was called, false otherwise". However, starting from v3.2.7 it returns positive even if HelpCrunch.initialize() wasn't called from the app itself.

TalbotGooday commented 1 year ago

An interesting clarification. If the state problem is indeed confirmed, then we will fix it in the next release. Thanks about this :+1:

TalbotGooday commented 1 year ago

In any case, I do not recommend doing a custom check for initialization. This check is already inside this method :sweat_smile:

TalbotGooday commented 1 year ago

Fixed a long time ago. Forgot to close