https://bugs.kde.org/show_bug.cgi?id=515507
Bug ID: 515507
Summary: SMS plugin fails to load in v1.35.1 — R8 optimization
breaks android-smsmms PduPersister classes
Classification: Applications
Product: kdeconnect
Version First unspecified
Reported In:
Platform: Android
OS: Linux
Status: REPORTED
Severity: major
Priority: NOR
Component: android-application
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
Description:
After updating from KDE Connect Android v1.34.4 to v1.35.1, the SMS plugin
fails to load entirely. The phone logs
show SMSPlugin.onCreate() throwing an exception during MMS parsing, which
causes Device.addPlugin() to return false.
All subsequent SMS requests from the desktop fail with "no plugin can handle
it".
Steps to reproduce:
1. Install KDE Connect Android v1.35.1 from the Play Store (release build)
2. Pair with a desktop running KDE Connect
3. Request SMS conversations from the desktop
4. Observe "Ignoring packet with type kdeconnect.sms.request_conversations
because no plugin can handle it" in
logcat
Expected behavior:
SMS plugin loads successfully and conversations are returned.
Actual behavior:
SMSPlugin.onCreate() crashes during MMS parsing. The plugin is never
registered and all SMS functionality is broken.
Logcat output (filtered to KDE Connect, captured via adb logcat --pid=<PID>):
E KDE/addPlugin: plugin failed to load SMSPlugin
E KDE/addPlugin: java.lang.Exception
E KDE/addPlugin: at
org.kde.kdeconnect.helpers.SMSHelper.getMessagePdu(...)
E KDE/addPlugin: at org.kde.kdeconnect.helpers.SMSHelper.parseMMS(...)
E KDE/addPlugin: at org.kde.kdeconnect.helpers.SMSHelper.getMessages(...)
E KDE/addPlugin: at
org.kde.kdeconnect.helpers.SMSHelper.getMessagesInRange(...)
E KDE/addPlugin: at
org.kde.kdeconnect.helpers.SMSHelper.getNewestMessageTimestamp(...)
E KDE/addPlugin: at
org.kde.kdeconnect.plugins.sms.SMSPlugin.onCreate(...)
E KDE/addPlugin: at org.kde.kdeconnect.Device.addPlugin(...)
E KDE/addPlugin: at
org.kde.kdeconnect.Device.reloadPluginsFromSettings(...)
...
W Ignoring packet with type kdeconnect.sms.request_conversations because no
plugin can handle it
Root cause analysis:
Commit 8f6a2b5e changed the ProGuard base file from proguard-android.txt to
proguard-android-optimize.txt. The
former includes -dontoptimize; the latter does not.
The project's proguard-rules.pro keeps org.kde.kdeconnect.** and
org.apache.sshd.**, but does not keep the
com.google.android.mms.** classes provided by the android-smsmms dependency
(org.kde.invent.sredman:android-smsmms).
That library also ships no consumer ProGuard rules.
With R8 optimization enabled, the PduPersister, PduCache, and
MultimediaMessagePdu classes from the android-smsmms
library are aggressively transformed. This breaks PduPersister.load(), which
is called by SMSHelper.getMessagePdu()
during parseMMS(). The exception propagates up through the catch blocks
(likely because R8 also transforms the
exception handling in getMessagePdu() and getMessages()) and reaches
Device.addPlugin(), which catches it and
prevents the SMS plugin from loading.
This worked in v1.34.4 because -dontoptimize prevented R8 from transforming
code in unprotected classes.
Proposed fix:
Add to proguard-rules.pro:
# The android-smsmms library uses reflection-heavy PDU parsing classes
# that break under R8 optimization
-keep class com.google.android.mms.** {*;}
Alternatively, the android-smsmms library itself should ship consumer
ProGuard rules via consumerProguardFiles in
its build.gradle.
Environment:
- KDE Connect Android: 1.35.1 (Play Store release)
- Device: Samsung Galaxy S24+ (SM-S926U1)
- Android version: 15
- Desktop: KDE Connect daemon via cosmic-ext-connected on Linux
- v1.34.4 worked correctly on the same device
--
You are receiving this mail because:
You are watching all bug changes.