I tried everything, but the error not getting solved
Here is my code:
public String[] getWeekDays() {
LocalDate today = LocalDate.now();
Loc
NoClassDefFoundError-Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
LocalDate today = LocalDate.now(); // Added 1.8
Read LocalDate
Make sure, You added this in your build.gradle
section.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
FYI
java.time
package was added only in API 26.
So, You should set
minSdkVersion 26
After that, Clean-Rebuild-Gradle
.