mangstadt/ez-vcard

Getting crash reports in the release version of the android app

Closed this issue · 4 comments

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.Reader.read(char[])' on a null object reference
       at java.util.Properties$LineReader.readLine(Properties.java:432)
       at java.util.Properties.load0(Properties.java:348)
       at java.util.Properties.load(Properties.java:336)
       at ezvcard.Ezvcard.<clinit>(Ezvcard.java:127)
       at ezvcard.Ezvcard.write(Ezvcard.java:16)
       at ezvcard.VCard.write(VCard.java:166)

Looks like in is still null even after in = Ezvcard.class.getResourceAsStream("ez-vcard.properties"); line 126 in Ezvcard.java.

Debug version of the android app works fine. This issue is observed only in the release version of the app. Not sure why getResourceAsStream would not find the file only in the release version of the app.

Is there an android compatible version of this library available?

Several other people have reported the same issue. It appears to be related to Proguard. Unfortunately, I am not familiar with Android, so I can't provide any more details.

I recommend checking out the threads below. They include several solutions to the problem. Please let me know if you find a solution.

DAVx5 uses vcard4android, which uses ez-vcard too. Works perfectly for release builds. You can find its ProGuard rules here: https://gitlab.com/bitfireAT/davx5-ose/-/blob/dev-3.x-ose/app/proguard-rules-release.pro

In the latest ez-vcard release (0.11.3), I removed this .properties file completely, since so many people have reported having issues with it.

The file was largely unnecessary, as most of the information in the file rarely changes. Removing the file is also better from a performance perspective, as it removes the need to perform file I/O.