SDK V2 Android error NoSuchMethodError | Community
Skip to main content

SDK V2 Android error NoSuchMethodError

  • July 2, 2020
  • 7 replies
  • 0 views

Hello,

I use Chat v2 SDK for Android, because I need a feature attach file pdf, but when enter the chat activity, I get an error like this :

Stack trace:
java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;Ljava/lang/Boolean;Lzendesk/messaging/AttachmentSettings;)V in class Lzendesk/messaging/Update$State$UpdateInputFieldState; or its super classes (declaration of 'zendesk.messaging.Update$State$UpdateInputFieldState' appears in /data/app/com.myapp.android-1/base.apk:classes5.dex)
at zendesk.chat.TextField.getInputFieldState(TextField.java:111)
at zendesk.chat.Form.getNextInputFieldState(Form.java:117)
at zendesk.chat.ChatFormDriver.updateWithMessagingItems(ChatFormDriver.java:237)
at zendesk.chat.ChatFormDriver.next(ChatFormDriver.java:213)
at zendesk.chat.ChatFormDriver.drivePreChatFormCollection(ChatFormDriver.java:108)
at zendesk.chat.ChatFormStage.onAgentAvailable(ChatFormStage.java:110)
at zendesk.chat.ChatAgentAvailabilityStage$1.update(ChatAgentAvailabilityStage.java:68)
at zendesk.chat.ChatAgentAvailabilityStage$1.update(ChatAgentAvailabilityStage.java:61)
at zendesk.chat.ObservableData.notifyObservers(ObservableData.java:175)
at zendesk.chat.ObservableData.observe(ObservableData.java:105)
at zendesk.chat.ZendeskAccountProvider.observeAccount(ZendeskAccountProvider.java:51)
at zendesk.chat.ChatAgentAvailabilityStage.onChatInit(ChatAgentAvailabilityStage.java:61)
at zendesk.chat.ChatStatusCheckStage.processUpdate(ChatStatusCheckStage.java:132)
at zendesk.chat.ChatStatusCheckStage.access$000(ChatStatusCheckStage.java:23)
at zendesk.chat.ChatStatusCheckStage$1.update(ChatStatusCheckStage.java:83)
at zendesk.chat.ChatStatusCheckStage$1.update(ChatStatusCheckStage.java:80)
at zendesk.chat.ObservableData.notifyObservers(ObservableData.java:175)
at zendesk.chat.ObservableData.setData(ObservableData.java:161)
at zendesk.chat.ZendeskConnectionProvider$1.update(ZendeskConnectionProvider.java:64)
at zendesk.chat.ZendeskConnectionProvider$1.update(ZendeskConnectionProvider.java:61)
at zendesk.chat.MainThreadPoster$1$1.run(MainThreadPoster.java:38)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5283)
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:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

I tried to find where it was error but I haven't found it either, maybe there is advice what to do to fix the error?
Thank You

7 replies

Greg29
  • July 6, 2020

Hi @Nur Sulaeman! Could you provide the following information please?

  • What version of the Zendesk for Android SDK are you using?
  • Please make sure you've enabled logging for your SDK implementation. Is your implementation throwing any errors?
  • Please provide the code where you've initialized the SDK.
  • Finally, if there is any more info you can provide (problematic code, sample project, etc), that would be great!

  • July 10, 2020

Hi,

we're starting to see the same crash since we bumped from 2.0.0 to 2.2.0

 

Fatal Exception: java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;Ljava/lang/Boolean;Lzendesk/messaging/AttachmentSettings;)V in class Lzendesk/messaging/Update$State$UpdateInputFieldState; or its super classes (declaration of 'zendesk.messaging.Update$State$UpdateInputFieldState' appears in /data/app/...-sdwCZyqq0rhm8Fse9PbrvA==/base.apk!classes6.dex)
at zendesk.messaging.MessagingModel.<clinit>(MessagingModel.java:37)
at zendesk.messaging.MessagingModel_Factory.get(MessagingModel_Factory.java:34)
at zendesk.messaging.MessagingModel_Factory.get(MessagingModel_Factory.java:9)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at zendesk.messaging.MessagingViewModel_Factory.get(MessagingViewModel_Factory.java:20)
at zendesk.messaging.MessagingViewModel_Factory.get(MessagingViewModel_Factory.java:7)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at zendesk.messaging.DaggerMessagingComponent.messagingViewModel(DaggerMessagingComponent.java:80)
at zendesk.messaging.MessagingActivity.onCreate(MessagingActivity.java:109)
at android.app.Activity.performCreate(Activity.java:8066)
at android.app.Activity.performCreate(Activity.java:8054)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3733)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3939)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2373)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8147)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Greg29
  • July 13, 2020

Hi @LN Andrieux! Could you please share the information that I requested in my above post?


  • Author
  • July 14, 2020

Hello All' sorry I was late to reply to a message, I have successfully solved the error

LN Andrieux maybe there is still an old code that hasn't been deleted, if you find an old code like this

Zendesk.INSTANCE.setIdentity(identity), You don't need to use it again and delete it

if a different case can be informed again

Thank you Greg for attention


Greg29
  • July 15, 2020

Thank you for the update, Nur!


  • September 14, 2020

Hi, I'm having the exactly same issue when I updated to 5.0.0 version, and I can't find any solution, I need to change the chat activity to a request activity to stop crashing, hope you guys can give me some light on it.
 
This is how I initialize Zendesk:

 
Zendesk.INSTANCE.init(
this,
getString(R.string.zendesk_url),
getString(R.string.zendesk_app_id),
getString(R.string.zendesk_client_id)
)

Support.INSTANCE.init(Zendesk.INSTANCE)

Zendesk.INSTANCE.setIdentity(
AnonymousIdentity.Builder().withNameIdentifier(
getString(R.string.zendesk_chat_name_identifier)
).withEmailIdentifier(
null
).build()
)

Chat.INSTANCE.init(context, getString(R.string.zendesk_account_key))

And this is how I started the chat activity:

fun startChatV2() {
val chatConfiguration = ChatConfiguration.builder().withNameFieldStatus(PreChatFormFieldStatus.REQUIRED)
.withEmailFieldStatus(PreChatFormFieldStatus.REQUIRED).withPhoneFieldStatus(PreChatFormFieldStatus.REQUIRED)
.withAgentAvailabilityEnabled(true).withPreChatFormEnabled(true).build()

val profileProvider = Chat.INSTANCE.providers()!!.profileProvider()

val visitorInfo = VisitorInfo.builder().withName(student).build()
profileProvider.setVisitorInfo(visitorInfo, null)

MessagingActivity.builder().withEngines(ChatEngine.engine()).show(context, chatConfiguration)
}

  • January 18, 2021

Hi, I can tell you that I had the same error and got it fixed by removing the extra line in the build:


implementation group: 'com.zendesk', name: 'support', version: '5.0.2'


I hope this helps.