Only some users reporting "Resource Not Found" error. Does this make sense?
Asked Answered
B

4

37

I am seeing a a couple of errors coming up on Crittercism (Crash reporting service) for my published Android app. The trace is the following:

0   java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" ClassLoader: dalvik.system.PathClassLoader@45908320
1    at org.joda.time.tz.ZoneInfoProvider.openResource(ZoneInfoProvider.java:211)
2    at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:123)
3    at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:82)
4    at org.joda.time.DateTimeZone.getDefaultProvider(DateTimeZone.java:462)
5    at org.joda.time.DateTimeZone.setProvider0(DateTimeZone.java:416)
6    at org.joda.time.DateTimeZone.<clinit>(DateTimeZone.java:115)
7    at org.joda.time.chrono.GregorianChronology.<clinit>(GregorianChronology.java:71)
8    at org.joda.time.chrono.ISOChronology.<clinit>(ISOChronology.java:66)
9    at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:61)
10   at org.joda.time.DateTime.<init>(DateTime.java:155)

Searching shows this this is usually a compiling problem (Usually that the Joda Time Library was not added to the build path or something), but then why would only about 4 users out of a couple thousand see this error?

My only guess is that someone is trying to decompile the app to pirate it (Its a fairly popular paid app), and sees this error when they incorrectly re-compiled. In that case I am glad they are seeing errors and I dont need to worry about this.

The other weird thing is that the code causing the problem was surrounded by a try/catch, which didnt seem to catch it:

try {
    DateTime dt = new DateTime();
    DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
    return fmt.print(dt);
} catch (Exception e) {
    //Report issue to Analytics service
} 

Which to me, makes it seem even more unlikely that this error would show up on Crittercism, since it should've been caught. Can anyone explain this?

Braden answered 24/5, 2012 at 18:29 Comment(4)
I suspect it could be handset issue. It is better if you can get more info (OS version, manufacturer version of their phones). Dalvik VM they have might not have updated Joda library. Just guess. If they are recompiling your app, it is not big-deal to get Joda library. I don't think that is the case.Thekla
Looking at the diagnostics, it's all different types of phones and OS versions. The crash has a occured about 40 times ever out of maybe 10,000 app loads. I found one more interesting thing: The error says its coming from MyAppName-2.apk, when I submitted MyAppName.apk. Does this indicate anything?Braden
Have you found the problem? I am seeing similar exceptions for my own Android app.Savarin
Same issue here, any solution?Timbered
K
80

This can happen in the case you miss initialization:

JodaTimeAndroid.init(this);
Kimono answered 7/3, 2015 at 17:32 Comment(1)
This happens to me if I am using instant run and the activity/fragment that gets loaded hasn't set the init.Argon
I
4

Not crash but in Unit test, I see the same error message java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" when call to DateTimeFormatter class with joda-time-android

Add joda-time java dependency to test source set will fix the error in Unit test

testImplementation "joda-time:joda-time:$latestVersion"

Invasive answered 5/7, 2022 at 0:18 Comment(0)
W
0

I see similar, infrequent reports from a popular free app. I haven't reproduced it so far. There are various references to this problem sprinkled around the web, not all involving Android.

One clue: the ZoneInfoMap is a resource file in the original jar, not a class. So if any of the various app markets was stripping out non-class information (e.g. unjar then re-jar), ZoneInfoMap would be a candidate. Likewise, if any classloader utility had an issue, for security or stupidity, with non-class resources, ZoneInfoMap would be a candidate.

Another angle: could the problematic runtime environment have its own joda-time jar earlier in the classpath, one that lacks a /data/ segment?

Bottom line: seems like this is another example of the Wild West of Android, one that I've learned to ignore until I can find a repro.

Wini answered 29/1, 2014 at 23:54 Comment(0)
B
0

I have had the same problem and after a good deal of digging searching on google I figured it out. The ZoneInfoMap file is created by running jodaTime (ZoneInfoCompiler) with the arguments:

    -dst src\org\joda\time\tz\data src\org\joda\time\tz\src\africa 
src\org\joda\time\tz\src\antarctica src\org\joda\time\tz\src\asia 
src\org\joda\time\tz\src\australasia src\org\joda\time\tz\src\backward 
src\org\joda\time\tz\src\etcetera src\org\joda\time\tz\src\europe 
src\org\joda\time\tz\src\northamerica src\org\joda\time\tz\src\pacificnew 
src\org\joda\time\tz\src\southamerica src\org\joda\time\tz\src\systemv

This will add all the timezone to the jodaTimer, you can create more time Zone areas I believe if you know how as well, and you do not have to include all of them if you don't need all of them.

why it crashes with that error is because it is looking for a file that is not there. Not sure exactly why try catch is not working but I suspect it has something to do with the fact that the jodaTimer is a JAR library (mine was at least)?

Not sure if this is how it is meant to be done or if there is a better solution but that's what i did and it works for me now.

I hope this helps.

Brattishing answered 12/5, 2015 at 13:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.