I am new to Salesforce sdk. I am using In app messaging UI sdk to implement chat feature within app and it's working in debug build. When i run on release build it crash with attached stacks trace.
I have separate module for chat that was built in 2018 and now we are utilizing that to implement chat feature using salesforce (inAppMessaging)UI sdk.
Error pointing to this Salesforce class RichLinkImage (salesforce-async-messaging.github.io)
I have chat bubble in activity using fragment within that creating viewmodel to configure salesforce. I am also using obfuscation tool on release build. So I am not sure what is causing this error.
Logs
java.lang.IllegalArgumentException: No property for required constructor parameter #0 p0 of fun `<init>`(kotlin.String, kotlin.String?, kotlin.String?, kotlin.String, kotlin.String, kotlin.String?): com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.message.component.attachment.FileAsset.ImageAsset.RichLinkImage for class com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.message.component.attachment.FileAsset$ImageAsset$RichLinkImage image for class com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.message.format.StaticContentFormat$RichLinkFormat for interface com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.message.format.StaticContentFormat content for class com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.Message$StaticContentMessage for interface com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.Message abstractMessage for class com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.EntryPayload$MessagePayload for interface com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.EntryPayload at com.squareup.moshi.Moshi$ɩ.isCompatVectorFromResourcesEnabled(SourceFile:389) at com.squareup.moshi.Moshi.adapter(SourceFile:158) at com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.message.format.StaticContentFormat_RichLinkFormatJsonAdapter.<init>(SourceFile:28) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at com.squareup.moshi.internal.Util.generatedAdapter(SourceFile:588) at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.create(SourceFile:200) at com.squareup.moshi.Moshi.adapter(SourceFile:146) at com.squareup.moshi.Moshi.adapter(SourceFile:106) at com.squareup.moshi.Moshi.adapter(SourceFile:75) at com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory.create(SourceFile:216) at com.squareup.moshi.Moshi.adapter(SourceFile:146) at com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.Message_StaticContentMessageJsonAdapter.<init>(SourceFile:41) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at com.squareup.moshi.internal.Util.generatedAdapter(SourceFile:588) at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.create(SourceFile:200) at com.squareup.moshi.Moshi.adapter(SourceFile:146) at com.squareup.moshi.Moshi.adapter(SourceFile:106) at com.squareup.moshi.Moshi.adapter(SourceFile:75) at com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory.create(SourceFile:216) at com.squareup.moshi.Moshi.adapter(SourceFile:146) at com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.EntryPayload_MessagePayloadJsonAdapter.<init>(SourceFile:32) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at com.squareup.moshi.internal.Util.generatedAdapter(SourceFile:588) at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.create(SourceFile:200) at com.squareup.moshi.Moshi.adapter(SourceFile:146) at com.squareup.moshi.Moshi.adapter(SourceFile:106) at com.squareup.moshi.Moshi.adapter(SourceFile:75) at com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory.create(SourceFile:216) at com.squareup.moshi.Moshi.adapter(SourceFile:146) at com.squareup.moshi.Moshi.adapter(SourceFile:106) at com.squareup.moshi.Moshi.adapter(SourceFile:80) at com.salesforce.android.smi.network.internal.api.rest.RestService.<init>(SourceFile:66) at com.salesforce.android.smi.network.internal.api.rest.RestService.<init>(Unknown Source:0) 2024-01-31 14:30:43.444 31118-31118 AndroidRuntime usap64 E at com.salesforce.android.smi.network.internal.api.rest.RestService$Companion.create$default(SourceFile:339) at com.salesforce.android.smi.core.internal.ServiceLocator.restService(SourceFile:56) at com.salesforce.android.smi.core.internal.InternalCoreClient$Companion.create(SourceFile:171) at com.salesforce.android.smi.core.internal.InternalCoreClientFactory.create(SourceFile:31) at com.manulife.chatbot.fragments.ParentChatbotFragmentViewModel.coreClient(SourceFile:130) at com.manulife.chatbot.fragments.ParentChatbotFragmentViewModel.registerHiddenPreChatValuesProvider(SourceFile:54) at com.manulife.chatbot.fragments.ParentChatbotFragmentViewModel.setupMessaging(SourceFile:70) at com.manulife.chatbot.fragments.ParentChatbotFragmentViewModel.resetMessagingConfig(SourceFile:46) at com.manulife.chatbot.fragments.ParentChatbotFragmentViewModel.<init>(SourceFile:25) at com.manulife.chatbot.fragments.VMFactory.create(SourceFile:143) at androidx.lifecycle.ViewModelProvider$Factory.create(SourceFile:83) at androidx.lifecycle.ViewModelProvider.get(SourceFile:184) at androidx.lifecycle.ViewModelProvider.get(SourceFile:150) at com.manulife.chatbot.fragments.ParentChatbotFragment.onCreate(SourceFile:96) at com.manulife.chatbot.fragments.ChatbotFragment.onCreate(SourceFile:30) at androidx.fragment.app.Fragment.performCreate(SourceFile:3094) at o.ѳ.BuiltInFictitiousFunctionClassFactory(SourceFile:504) at o.ѳ.getPredefinedCategories(SourceFile:268) at androidx.fragment.app.FragmentManager.CipherOutputStream(SourceFile:1943) at androidx.fragment.app.FragmentManager.CipherOutputStream(SourceFile:1839) at androidx.fragment.app.FragmentManager.isCompatVectorFromResourcesEnabled(SourceFile:1782) at androidx.fragment.app.FragmentManager.setIconSize(SourceFile:3042) at androidx.fragment.app.FragmentManager.CipherOutputStream(SourceFile:2952) at androidx.fragment.app.FragmentController.dispatchActivityCreated(SourceFile:263) at androidx.fragment.app.FragmentActivity.onStart(SourceFile:350) at androidx.appcompat.app.AppCompatActivity.onStart(SourceFile:251) at ca.manulife.MobileBanking.CalligraphyActivity.onStart(Unknown Source:0) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1525) at android.app.Activity.performStart(Activity.java:8030) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3642) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2251) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8068) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978) Caused by: java.lang.IllegalArgumentException: No property for required constructor parameter #0 p0 of fun `<init>`(kotlin.String, kotlin.String?, kotlin.String?, kotlin.String, kotlin.String, kotlin.String?): com.salesforce.android.smi.network.data.domain.conversationEntry.entryPayload.message.component.attachment.FileAsset.ImageAsset.RichLinkImage at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.create(SourceFile:312) at com.squareup.moshi.Moshi.adapter(SourceFile:146)
keeprule.keep com.salesforce.android.smi.network.data.domain.conversationEntry.*but issue is still there. So I will try turning off the obfuscation and generate release build to see if that solves the problem.keepstatement is going to be more complex than you've listed, and why not just keep all of the salesforce stuff as-is? Note, I'm not saying this is your problem. Just smells like it :)-keepparameternamesThe Salesforce SDK is using the Moshi json library but without any annotations to preserve field names. Moshi is using kotlin-reflect to match constructor parameters to the json entries, and, predictably, throwing because the names do not match. Interestingly, this seems to only affect classes with non-property args, egclass MyClass(value: Int)instead ofval value