Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to run the app #50

Open
dino-sunny opened this issue May 28, 2020 · 9 comments
Open

Not able to run the app #50

dino-sunny opened this issue May 28, 2020 · 9 comments

Comments

@dino-sunny
Copy link

dino-sunny commented May 28, 2020

 Caused by: com.twilio.chat.ListenerException: Exception thrown by a listener. Your application might have a problem in listener implementation. Listeners must never throw uncaught exceptions. See 'Caused by:' below for more details.
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:123)
    at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    at $Proxy1.onClientSynchronization(Unknown Source)
    at com.twilio.chat.ChatClient$ChatClientListenerForwarder.setListener(ChatClient.java:837)
    at com.twilio.chat.ChatClient.setListener(ChatClient.java:534)
    at com.twilio.chatquickstart.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:317)
    at com.twilio.chatquickstart.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:314)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121)Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.twilio.chat.Channels com.twilio.chat.ChatClient.getChannels()' on a null object reference
    at com.twilio.chatquickstart.QuickstartChatManager.loadChannels(QuickstartChatManager.java:137)
    at com.twilio.chatquickstart.QuickstartChatManager.access$700(QuickstartChatManager.java:41)
    at com.twilio.chatquickstart.QuickstartChatManager$5.onClientSynchronization(QuickstartChatManager.java:251)
@jefflinwood
Copy link
Contributor

Hi,

Were you able to get this to work? Does your Chat app connect to your token server successfully?

Thanks!
Jeff

@jefflinwood
Copy link
Contributor

I'm going to close this issue out, but please reopen it if you have some feedback. Thank you!

@viveksinha121
Copy link

viveksinha121 commented Jan 9, 2021

This issue still persists. Please help to run.

2021-01-09 22:01:19.650 12185-12185/com.guftgu E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.guftgu, PID: 12185
com.twilio.chat.ListenerException: Exception thrown by a listener. Your application might have a problem in listener implementation. Listeners must never throw uncaught exceptions. See 'Caused by:' below for more details.
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:123)
at java.lang.reflect.Proxy.invoke(Proxy.java:813)
at $Proxy0.onSuccess(Unknown Source)
at com.twilio.chat.internal.CallbackListenerForwarder$1.run(CallbackListenerForwarder.java:34)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: com.twilio.chat.ListenerException: Exception thrown by a listener. Your application might have a problem in listener implementation. Listeners must never throw uncaught exceptions. See 'Caused by:' below for more details.
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:123)
at java.lang.reflect.Proxy.invoke(Proxy.java:813)
at $Proxy1.onClientSynchronization(Unknown Source)
at com.twilio.chat.internal.ChatClientListenerForwarder.addListener(ChatClientListenerForwarder.java:46)
at com.twilio.chat.ChatClient.addListener(ChatClient.java:532)
at com.guftgu.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:327)
at com.guftgu.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:324)
at java.lang.reflect.Method.invoke(Native Method)
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121)
at java.lang.reflect.Proxy.invoke(Proxy.java:813) 
at $Proxy0.onSuccess(Unknown Source) 
at com.twilio.chat.internal.CallbackListenerForwarder$1.run(CallbackListenerForwarder.java:34) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.twilio.chat.Channels com.twilio.chat.ChatClient.getChannels()' on a null object reference
at com.guftgu.QuickstartChatManager.loadChannels(QuickstartChatManager.java:138)
at com.guftgu.QuickstartChatManager.access$700(QuickstartChatManager.java:42)
at com.guftgu.QuickstartChatManager$5.onClientSynchronization(QuickstartChatManager.java:261)
at java.lang.reflect.Method.invoke(Native Method)
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121)
at java.lang.reflect.Proxy.invoke(Proxy.java:813) 
at $Proxy1.onClientSynchronization(Unknown Source) 
at com.twilio.chat.internal.ChatClientListenerForwarder.addListener(ChatClientListenerForwarder.java:46) 
at com.twilio.chat.ChatClient.addListener(ChatClient.java:532) 
at com.guftgu.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:327) 
at com.guftgu.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:324) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121) 
at java.lang.reflect.Proxy.invoke(Proxy.java:813) 
at $Proxy0.onSuccess(Unknown Source) 
at com.twilio.chat.internal.CallbackListenerForwarder$1.run(CallbackListenerForwarder.java:34) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

@LennyDennis
Copy link

LennyDennis commented Mar 1, 2021

Am also getting a similar error @jefflinwood. The app is able to connect to the server and retrieve the token successfully. It crashes shortly after.

@jefflinwood jefflinwood reopened this Mar 2, 2021
@jefflinwood
Copy link
Contributor

@LennyDennis are you getting a null pointer exception when it tries to access the ChatClient's channels as well?

Thanks!

@LennyDennis
Copy link

LennyDennis commented Mar 2, 2021

@jefflinwood Yes. Here is the error.

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.twilio.chat.Channels com.twilio.chat.ChatClient.getChannels()' on a null object reference
at com.twilio.chatquickstart.QuickstartChatManager.loadChannels(QuickstartChatManager.java:137)
at com.twilio.chatquickstart.QuickstartChatManager.access$700(QuickstartChatManager.java:41)
at com.twilio.chatquickstart.QuickstartChatManager$5.onClientSynchronization(QuickstartChatManager.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006) 
at $Proxy1.onClientSynchronization(Unknown Source) 
at com.twilio.chat.internal.ChatClientListenerForwarder.addListener(ChatClientListenerForwarder.java:46) 
at com.twilio.chat.ChatClient.addListener(ChatClient.java:532) 
at com.twilio.chatquickstart.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:326) 
at com.twilio.chatquickstart.QuickstartChatManager$6.onSuccess(QuickstartChatManager.java:323) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.twilio.chat.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121) 
at java.lang.reflect.Proxy.invoke(Proxy.java:1006) 
at $Proxy0.onSuccess(Unknown Source) 
at com.twilio.chat.internal.CallbackListenerForwarder$1.run(CallbackListenerForwarder.java:34) 
at android.os.Handler.handleCallback(Handler.java:873) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6669) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

@jefflinwood
Copy link
Contributor

Hi,

I think this was a race condition between setting the chat client as a member variable in the Chat Manager and setting the listener - I reversed the order of those two in

#78

which is merged into master. Thanks for bringing this up, everyone!

@LennyDennis
Copy link

Thanks !

@kosiara
Copy link

kosiara commented Jul 18, 2021

I had a similar issue when using Flutter's https://pub.dev/packages/twilio_programmable_chat

The following series of calls caused native Android crash:

final chatClient = TwilioProgrammableChat.create();
final channel = await chatClient.channels.getChannel(chat.channel);
final messages = await channel.messages.getLastMessages(50);

I had to INSERT a useless delay to resolve this issue.

Future.delayed(Duration(milliseconds: 700), () async {
   final messages = channel.messages.getLastMessages(50);
}

the error was:

com.twilio.chat.ListenerException: Exception thrown by a listener. Your application might have a problem in listener implementation. Listeners must never throw uncaught exceptions. See 'Caused by:' below for more details.

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.twilio.chat.Messages.getLastMessages(int, com.twilio.chat.CallbackListener)' on a null object reference
E/AndroidRuntime( 1663): at twilio.flutter.twilio_programmable_chat.methods.MessagesMethods$getLastMessages$1.onSuccess(MessagesMethods.kt:208)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants