I am trying to use DateTimeFormatter to format date and time. Using below code
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy/MM/dd");
dateFormat.format(LocalDateTime.now());
But it throws NoClassDefFoundError.
My gradle file having below configuration:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
I am not getting what is wrong here.