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

前端 未结 3 1219
太阳男子
太阳男子 2020-12-03 04:04

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

When I write LocalDate today=L

3条回答
  •  温柔的废话
    2020-12-03 05:00

    For Android project you should use

    implementation '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.

提交回复
热议问题