Open FredFirestone opened 9 years ago
Do you have a sample calendar file to demonstrate the issue? ical4j should only create XComponents/XProperties when it can't identify an appropriate factory.
(Have created a new issue for that, see #43)
Since the last release (ical4j-2.0-alpha1) I have refactored the registration of factories to reduce code duplication and make it a bit more extensible. To do this I am using the java.util.ServiceLoader, which relies on resource files in the META-INF/services directory.
I suspect what is happening is that the META-INF/services folder isn't being packaged into the APK, and so the factories aren't being registered properly. This would explain why all the components are XComponents and properties are XProperties. I found a bug report on the ApkBuilder that strips the META-INF directory, which may be the cause depending on how you are building the APK:
https://code.google.com/p/android/issues/detail?id=59658
I haven't tried to build an APK from the latest ical4j code so I may be off the mark, but it sounds like the Gradle based build doesn't have this issue. Would you be able to confirm whether the META-INF/services directory is being packaged into your APK?
Thank's for your efforts, you seem to have hit the issue: My apk does indeed not have the META-INF/services directory. I've likely not used gradle, so you may be right that Gradle based builds would not have this issue. Thanks again for getting to the bottom of this.
I am in the same situation. I am trying to parse the iCal below and am encountering the same problems with XProperties and XComponents. Ideally, I was hoping to be able to get 'EST' after the iCal is parsed. I tried adding the files manually, zipping the apk and resigning it, but android does not like the apk. I am using 2.0.1 beta jar. Any ideas/works-arounds would be appreciated.
BEGIN:VCALENDAR PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN VERSION:2.0 METHOD:REQUEST BEGIN:VTIMEZONE TZID:Eastern Time BEGIN:STANDARD DTSTART:20131101T020000 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 TZOFFSETFROM:-0400 TZOFFSETTO:-0500 TZNAME:Standard Time END:STANDARD BEGIN:DAYLIGHT DTSTART:20130301T020000 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 TZOFFSETFROM:-0500 TZOFFSETTO:-0400 TZNAME:Daylight Savings Time END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT ATTENDEE;CN="A B";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:ab@yahoo.com ORGANIZER;CN="A C":MAILTO:ac@yahoo.com DTSTART;TZID="Eastern Time":20150813T200453 DTEND;TZID="Eastern Time":20150813T201953 LOCATION:https://blackberry.webex.com/blackberry TRANSP:OPAQUE SEQUENCE:1439510693 UID:f9e4688f-4e92-405a-943a-a611ea8d8692 DTSTAMP:20150814T000453Z DESCRIPTION:\nJOIN WEBEX MEETING\n SUMMARY:test1 PRIORITY:5 CLASS:PUBLIC END:VEVENT END:VCALENDAR
I still don't have a solution for this, as I haven't had time to experiment with Android. Here is some more info about the issue and what other devs are trying (some successfully it seems):
http://stackoverflow.com/questions/5760607/using-serviceloader-on-android
I've modified davdroid on android which is using ical4j. Unfortunately parsing my calendar entries yields XComponents and all properties are XProperties.
Thus I get massive errors using it, like class cast exceptions on .getUid() which leads me to assume the factory creation process is not working as intended.
Is there anything I am missing? Any configuration to influcence which properties are created?