简体   繁体   中英

Android Studio stack=java.lang.NoClassDefFoundError: Failed resolution of: Landroid/icu/util/Calendar;

I have used the calendar class for a alarm app with the alarm manager , but I have an error with the instance of the class calendar . I have investigated in other forums but I haven't find the proper solutions. please I need your help.

the error is marked in the instance of the calendar class enter image description here

As far as i can see, you could just use the normalCalendar instead of the in API 24 introduced ICU Calendar . Try to use this import java.util.Calendar instead of this import android.icu.util.Calendar .

From Calendar pick date: import java.util.Calendar instead of this import android.icu.util.Calendar And Then write those code code for Date Pick.

Calendar callForDate = Calendar.getInstance();

java.text.SimpleDateFormat currentDate = new java.text.SimpleDateFormat("dd-MMMM-yyyy");

final String saveCurrentDate = currentDate.format(callForDate.getTime());

I had the same problem, changed the import from android.icu.util.Calendar to java.util.Calendar and it work! hope it helps you!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM