Recent searches


No recent searches

Crash with Proguard in Release Mode

Answered


Posted Mar 22, 2022

Hi!

Implementing the latest SDKs, running the app in Proguard mode causes a crash that can't be traced back due to obfuscation.
Executing the code without Proguard works just fine.
The error occurs, when I'm clicking the "start a conversation" button.

I have followed the recommended settings for Proguard and R8

Even with over-configuration, definitely covering all cases, the error still occurs.


Proguard Config:

-keep class zendesk.** { *; }
-keepnames class zendesk.** { *; }
-keep class sun.misc.Unsafe { *; }
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

Crash Log:

E/AndroidRuntime(17612): FATAL EXCEPTION: main
E/AndroidRuntime(17612): Process: com.[REDACTED].android, PID: 17612
E/AndroidRuntime(17612): java.util.MissingFormatArgumentException: Format specifier '%s'
E/AndroidRuntime(17612):     at java.util.Formatter.format(Formatter.java:2523)
E/AndroidRuntime(17612):     at java.util.Formatter.format(Formatter.java:2459)
E/AndroidRuntime(17612):     at java.lang.String.format(String.java:2911)
E/AndroidRuntime(17612):     at i.z.c.a.i(Unknown Source:7)
E/AndroidRuntime(17612):     at i.z.c.a.l(Unknown Source:3)
E/AndroidRuntime(17612):     at zendesk.support.request.DocumentRenderer$HtmlParser.<init>(Unknown Source:40)
E/AndroidRuntime(17612):     at zendesk.support.request.CellFactory.<init>(Unknown Source:12)
E/AndroidRuntime(17612):     at zendesk.support.request.RequestModule.providesMessageFactory(Unknown Source:14)
E/AndroidRuntime(17612):     at zendesk.support.request.RequestModule_ProvidesMessageFactoryFactory.providesMessageFactory(Unknown Source:9)
E/AndroidRuntime(17612):     at zendesk.support.request.RequestModule_ProvidesMessageFactoryFactory.get(Unknown Source:48)
E/AndroidRuntime(17612):     at zendesk.support.request.RequestModule_ProvidesMessageFactoryFactory.get(Unknown Source:0)
E/AndroidRuntime(17612):     at k.c.a.get(Unknown Source:13)
E/AndroidRuntime(17612):     at zendesk.support.DaggerSupportSdkComponent$RequestComponentImpl.injectRequestViewConversationsEnabled(Unknown Source:22)
E/AndroidRuntime(17612):     at zendesk.support.DaggerSupportSdkComponent$RequestComponentImpl.inject(Unknown Source:0)
E/AndroidRuntime(17612):     at zendesk.support.request.RequestViewConversationsEnabled.init(Unknown Source:0)
E/AndroidRuntime(17612):     at zendesk.support.request.ComponentRequestRouter.update(Unknown Source:76)
E/AndroidRuntime(17612):     at zendesk.support.request.ComponentRequestRouter.update(Unknown Source:2)
E/AndroidRuntime(17612):     at x.d.l$d.b(Unknown Source:26)
E/AndroidRuntime(17612):     at x.d.s.o(Unknown Source:39)
E/AndroidRuntime(17612):     at x.d.s.j(Unknown Source:0)
E/AndroidRuntime(17612):     at x.d.s$a$a.a(Unknown Source:78)
E/AndroidRuntime(17612):     at x.d.b.b(Unknown Source:27)
E/AndroidRuntime(17612):     at x.d.b.a(Unknown Source:0)
E/AndroidRuntime(17612):     at x.d.b$a.a(Unknown Source:11)
E/AndroidRuntime(17612):     at zendesk.support.request.AsyncMiddleware.onAction(Unknown Source:25)
E/AndroidRuntime(17612):     at x.d.b.b(Unknown Source:23)
E/AndroidRuntime(17612):     at x.d.b.onAction(Unknown Source:13)
E/AndroidRuntime(17612):     at x.d.s$a.run(Unknown Source:22)
E/AndroidRuntime(17612):     at x.d.g$a.execute(Unknown Source:10)
E/AndroidRuntime(17612):     at x.d.s.c(Unknown Source:8)
E/AndroidRuntime(17612):     at zendesk.support.request.ActionLoadSettings$1.onSuccess(Unknown Source:18)
E/AndroidRuntime(17612):     at zendesk.support.request.ActionLoadSettings$1.onSuccess(Unknown Source:2)
E/AndroidRuntime(17612):     at zendesk.support.ZendeskSupportSettingsProvider$LoadSupportSettings$LoadHelpCenterSettings.onSuccess(Unknown Source:46)
E/AndroidRuntime(17612):     at zendesk.support.ZendeskSupportSettingsProvider$LoadSupportSettings$LoadHelpCenterSettings.onSuccess(Unknown Source:2)
E/AndroidRuntime(17612):     at zendesk.core.ZendeskSettingsProvider.getSettingsForSdk(Unknown Source:33)
E/AndroidRuntime(17612):     at zendesk.support.ZendeskSupportSettingsProvider$LoadSupportSettings.onSuccess(Unknown Source:17)
E/AndroidRuntime(17612):     at zendesk.support.ZendeskSupportSettingsProvider$LoadSupportSettings.onSuccess(Unknown Source:2)
E/AndroidRuntime(17612):     at zendesk.core.ZendeskSettingsProvider.getSettingsForSdk(Unknown Source:33)
E/AndroidRuntime(17612):     at zendesk.support.ZendeskSupportSettingsProvider.getSettings(Unknown Source:11)
E/AndroidRuntime(17612):     at zendesk.support.request.ActionLoadSettings.execute(Unknown Source:7)
E/AndroidRuntime(17612):     at zendesk.support.request.AsyncMiddleware$QueueItem.execute(Unknown Source:6)
E/AndroidRuntime(17612):     at zendesk.support.request.AsyncMiddleware$Queue.dispatchInternal(Unknown Source:32)
E/AndroidRuntime(17612):     at zendesk.support.request.AsyncMiddleware$Queue.access$300(Unknown Source:0)
E/AndroidRuntime(17612):     at zendesk.support.request.AsyncMiddleware$Queue$QueueCallback.done(Unknown Source:22)
E/AndroidRuntime(17612):     at zendesk.support.request.ActionInstallConfiguration$1$1.run(Unknown Source:23)
E/AndroidRuntime(17612):     at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(17612):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(17612):     at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(17612):     at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(17612):     at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17612):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(17612):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

SDK versions:

api group: 'com.zendesk', name: 'messaging', version: '5.2.3'
api group: 'com.zendesk', name: 'support', version: '5.0.8'
api group: 'com.zendesk', name: 'answerbot', version: '3.0.7'
api group: 'com.zendesk', name: 'chat', version: '3.3.3'

4

7

7 comments

Hi Zendesk-Team

We've run our own internal investigation of the SDK issue, and have found the root cause.

s.b.a.a: caused by: s.b.a.a: resource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory make sure that parser implementing XmlPull API is available

It looks like for some reason the class is removed during proguard / R8 processing.

However, this should be caught by your error handling, which itself is faulty:
The cause of the crash is due to invalid logging on the error handling side.

zendesk.support.request.DocumentRenderer.HtmlParser

try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setValidating(false);
factory.setFeature(Xml.FEATURE_RELAXED, true);
xmlPullParser = factory.newPullParser();
} catch (XmlPullParserException var6) {
Logger.w("RequestActivity", "Unable to parse rich text. Error: '%s' | '%s'", new Object[]{var6.getLocalizedMessage()});
} finally {
this.xpp = xmlPullParser;
}

Where `Logger.w`s string format expects two arguments, but only is given one.

 

Could this be fixed in a bugfix of your SDK?

0


Sebastian Schneider I have the exact same issue. Did you find any solution? It seems to be still happening with the latest Zendesk SDK.

0


So I was using Zendesk SDK with Flutter, and it seems like the root issue is caused by:

dev_dependencies:
  integration_test:
    sdk: flutter

in pubspec.yaml.

0


I have the same crashes.
Sebastian Schneider Did you find a solution?

0


image avatar

Neil

Zendesk Customer Care

Hi Joshua,
 
As per our Progaurd docs, any issue that could be associated with Proguard should be reproduced with the default set of rules, present in our sample apps. Have you made an attempt to recreate this issue in a sample app with Progaurd?

0


I can confirm that the issue exists in Support SDK 5.2.0 when build in release mode even when have recommended rules as the original issue reporter mentions. The problem is in R8 optimisations (replacement for ProGuard in Android apps enabled by default for some time already) optimisations which might too aggressive for Zendesk's Support SDK.

In the sample app for some reason you have minification disabled, which is not an option for most projects: https://github.com/zendesk/android_sdk_demo_apps/blob/master/support_sample/build.gradle#L21

There is work to do for Zendesk developers to update the recommended set of rules for ProGuard (R8 uses same config file with rules).

 

0


Thanks to info provided by Sebastian Schneider I was able to find a solution to this crash.

So, to anyone still having this crash add this rule to your proguard-rules file:

-keep class org.xmlpull.** { *; }

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post