我无法让ThreeTenABP工作。这是我所做的:
在应用程序build.gradle中导入依赖项
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.1'
初始化MyApplication.onCreate()中的库
AndroidThreeTen.init(this)
将MyApplication添加到清单
<application android:name=".MyApplication" ...>
使用Instant解析字符串
Instant.parse(updatedOn)
Instant
唯一可能的导入是java.time.Instant
。但这直到Android API 26才可用,这就是为什么我要首先使用ThreeTenABP的原因。
我发现了一些使用导入org.threeten.bp.Instant
的示例,但是在我的情况下找不到该导入/包。
我已经做了臭名昭著的“使缓存无效并重新启动”,但无济于事。还有其他我想念的东西吗?
答案 0 :(得分:0)
好的,对不起,你们浪费时间了。我在错误的应用程序模块中添加了依赖项。现在一切正常。