Sharing a contact with a photo fails: NoSuchMethodException: ezvcard.parameter.ImageType.<init> (missing ProGuard keep rule)

Open Beginner friendly
#15,148 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, kotlin
Domain
mobile

Research direction

Start with app/proguard/proguard-ez-vcard.pro and the ContactCardReader path named in the stack trace. Check how the ez-vcard dependency uses ImageType constructors reflectively, then confirm the release R8 rules preserve the required constructor. Done when sharing vCards with photos succeeds for the reported vCard formats; the suggested graceful fallback is an additional behavior to assess.

Written by the indexing model from the issue text.

Description

Guidelines
  • I have searched open and closed issues for duplicates
  • I am submitting a bug report for existing functionality that does not work as intended
  • This isn't a feature request or a discussion topic
Bug description

Sharing a contact that has a photo from a contacts app to Signal fails: Signal opens its share screen, then reports it cannot read the contact. Contacts without a photo share fine.

This is not specific to one contacts app: it fails with both vCard 4.0 (Fossify Contacts) and vCard 3.0 (AOSP-based Contacts app), i.e. whatever exporter produces the .vcf.

Logcat shows the vCard parser failing inside ez-vcard:

W ContactCardReader: Failed to parse the vcard.
W ContactCardReader: java.lang.RuntimeException: java.lang.NoSuchMethodException:
  ezvcard.parameter.ImageType.<init> [class java.lang.String, class java.lang.String, class java.lang.String]
W ShareContactViewModel: Could not read a contact to share.

Steps to reproduce

  1. Pick a contact that has a photo.
  2. Share it from the contacts app to Signal (text/x-vcard).
  3. Signal's share screen opens, then fails to read the contact.

Case A — Fossify Contacts 1.6.0, vCard 4.0 (PHOTO;MEDIATYPE=…), shared URI content://org.fossify.contacts.provider/shared_contacts/contact.vcf:

W ContactCardReader: java.lang.RuntimeException: java.lang.NoSuchMethodException:
  ezvcard.parameter.ImageType.<init> [class java.lang.String, class java.lang.String, class java.lang.String]
W ContactCardReader:  at ezvcard.VCardDataType$1.create
W ContactCardReader:  at ezvcard.VCardDataType$1.get
W ContactCardReader:  at ezvcard.io.scribe.ListPropertyScribe._mediaTypeFromMediaTypeParameter
W ContactCardReader:  at ezvcard.io.scribe.ListPropertyScribe._parseText
W ContactCardReader:  at ezvcard.io.text.VCardReader.readNext
W ContactCardReader:  at org.thoughtcrime.securesms.contactshare.ContactCardReader.fromVcard
W ContactCardReader:  at ...contactshare.screens.share.ShareContactRepository$load$2.invokeSuspend

Case B — Contacts app of the same ROM, vCard 3.0 (VCardComposer, shared URI content://com.android.contacts/contacts/as_vcard/….vcf), identical failure, only the ez-vcard frame differs:

W ContactCardReader:  at ezvcard.io.scribe.ListPropertyScribe._mediaTypeFromTypeParameter
W ContactCardReader:  at ezvcard.io.scribe.ListPropertyScribe._parseText

Analysis / suspected cause

ez-vcard (0.9.11) resolves a PHOTO media type through VCardDataType.create, which instantiates the media type class reflectively (Class.getDeclaredConstructor(String, String, String)) whenever the value is not one of the predefined constants. R8 removes that constructor of ezvcard.parameter.ImageType because it is only reached by reflection, hence NoSuchMethodException and the failed share.

Signal's ProGuard configuration for this library does not keep it: app/proguard/proguard-ez-vcard.pro currently contains only

-dontwarn ezvcard.io.html.HCardPage

Suggested fix:

-keep class ezvcard.parameter.** {
    <init>(java.lang.String, java.lang.String, java.lang.String);
}

It would also be useful for ContactCardReader to degrade gracefully (share the contact without its photo) instead of failing the whole share.

Screenshots

N/A (failure happens before any UI is shown).

Device

Fairphone 5 (FP5)

Android version

15 (SDK 35), /e/OS 4.4.2-a15, build BP1A.250505.005 (no Google Play services)

Signal version

8.37.3 (versionCode 178601)

Link to debug log

Not included in this report — I can post a debuglogs.org link in a follow-up comment if you want it.

Filtered logcat (vCard 3.0 case, contact name and numbers redacted)
11-26 18:23:48.744 31631  3004 D VCardComposer: Use the charset "UTF-8"
11-26 18:23:48.749 31631  3004 I VCardComposer: Cursor#moveToNext() returned false
11-26 18:23:48.767 31631 13372 D VCardComposer: Use the charset "UTF-8"
11-26 18:23:48.771 31631 13372 I VCardComposer: Cursor#moveToNext() returned false
11-26 18:23:51.911  9036  9083 D ShareContactViewModel: [Event] Initialize
11-26 18:23:51.916  9036  9083 W ContactCardReader: Failed to parse the vcard.
11-26 18:23:51.916  9036  9083 W ContactCardReader: java.lang.RuntimeException: java.lang.NoSuchMethodException: ezvcard.parameter.ImageType.<init> [class java.lang.String, class java.lang.String, class java.lang.String]
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at androidx.camera.camera2.adapter.ZslControlImpl$$ExternalSyntheticLambda1.m(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:37)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at ezvcard.VCardDataType$1.create(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:116)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at ezvcard.VCardDataType$1.get(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:37)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at ezvcard.io.scribe.ListPropertyScribe._mediaTypeFromTypeParameter(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:8)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at ezvcard.io.scribe.ListPropertyScribe._parseText(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:171)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at ezvcard.io.text.VCardReader.readNext(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:678)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at org.thoughtcrime.securesms.contactshare.ContactCardReader.fromVcard(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:45)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at org.thoughtcrime.securesms.contactshare.ContactCardReader.readVCard(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:4)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at org.thoughtcrime.securesms.contactshare.screens.share.ShareContactRepository$load$2.invokeSuspend(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:98)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:8)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at kotlinx.coroutines.DispatchedTask.run(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:114)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at kotlinx.coroutines.ResumeUndispatchedRunnable.run(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:12)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at kotlinx.coroutines.scheduling.TaskImpl.run(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:3)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:85)
11-26 18:23:51.916  9036  9083 W ContactCardReader: Caused by: java.lang.NoSuchMethodException: ezvcard.parameter.ImageType.<init> [class java.lang.String, class java.lang.String, class java.lang.String]
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at java.lang.Class.getConstructor0(Class.java:3395)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at java.lang.Class.getDeclaredConstructor(Class.java:3077)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	at ezvcard.VCardDataType$1.create(r8-map-id-a5e0f241a6973394087db6f9a45e4d18244c49fc39bec18d6b894857c7021a47:86)
11-26 18:23:51.916  9036  9083 W ContactCardReader: 	... 12 more
Dominant language
Kotlin
Stars
29.7k
Forks
7k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from signalapp/Signal-Android

All issues in signalapp/Signal-Android

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.