Only some users reporting “Resource Not Found” error. Does this make sense?

99封情书 提交于 2019-11-30 10:48:50

This can happen in the case you miss initialization:

JodaTimeAndroid.init(this);

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.

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 perfectly now.

references that helped m come to this conclusion: http://joda-interest.219941.n2.nabble.com/How-to-run-Joda-time-s-test-Resource-Not-Found-exception-td5913668.html http://sourceforge.net/p/joda-time/discussion/337835/thread/2798a578/

I hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!