Matan Itzhak Matan Itzhak - 1 year ago 171
Android Question

ThreeTen-Backport error on Adnroid - ZoneRulesException: No time-zone data files registered

I'm using ThreeTen-Backport library for my Android project (because java.time is not yet implemented in android development).

When I write

I get the following exception:

Caused by:
No time-zone data files registered
at org.threeten.bp.ZoneRegion.ofId(
at org.threeten.bp.ZoneId.of(
at org.threeten.bp.ZoneId.of(
at org.threeten.bp.ZoneId.systemDefault(
at org.threeten.bp.Clock.systemDefaultZone(

The same line of code works well in another java project I have, which uses the native java.time library.

I searched for a possible solution but couldn't find anything useful: one solution suggested I need to use another jar that includes the time-zone rules and other suggested that there might be two or more ThreeTenBP-libraries inside the classpath.

Those cases don't match my case.

Inside the
file, at the dependencies section, I've tried few configurations:

  • At first, I used -
    compile 'com.jakewharton.threetenabp:threetenabp:1.0.3'

  • Then, I tried -
    compile 'org.threeten:threetenbp:1.0.3'

  • After that, I tried -
    compile 'org.threeten:threetenbp:1.3.1'

  • Currently, I use
    compile 'org.threeten:threetenbp:1.3.2'

I don't know what is wrong with that line of code and how to fix it.

methods should work without specifying a time zone.

I would appreciate your help in that matter.

Answer Source

For Android project you should use

compile 'com.jakewharton.threetenabp:threetenabp:1.0.3

Make sure you call AndroidThreeTen.init(this); before using the classes from the library. This will read the time zones data (included in the library). You can initialize the library in your Application class in the onCreate method just like it is recommended in the README.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download