OffsetDateTime.now() requires API 26
You can use Java 8+ API desugaring support (Android Gradle Plugin 4.0.0+)
It is described in this link
Simply you have to modify your build.gradle file in your app module like this:
android {
defaultConfig {
// Required when setting minSdkVersion to 20 or lower
multiDexEnabled true
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
}
java.time
APIs on Android require API 26.
For older API levels you can use ThreeTenABP which is the Android version of JSR-310 java.time
backport for Java 6.