I can't get ThreeTenABP to work. Here's what I did:
import dependency in app build.gradle
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.1'
initialize the library in MyApplication.onCreate()
AndroidThreeTen.init(this)
add MyApplication to Manifest
<application android:name=".MyApplication" ...>
Use Instant to parse a String
Instant.parse(updatedOn)
The only possible import for Instant
is java.time.Instant
. But this is not available until Android API 26, which is why I want to use ThreeTenABP in the first place. I found some examples using an import org.threeten.bp.Instant
, but this import/package cannot be found in my case. I already did the infamous "Invalidate cache and restart", but to no avail. Is there anything else I am missing??
Okay sorry guys for waisting your time. I was adding the dependency in the wrong app-module. Now everything is working.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.