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

the error is marked in the instance of the calendar class

enter image description here

Upvotes: 9

Views: 8299

Answers (3)

Maizied Hasan Majumder
Maizied Hasan Majumder

Reputation: 1053

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());

Upvotes: 2

Jose Armando
Jose Armando

Reputation: 1

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

Upvotes: 0

Tyrmos
Tyrmos

Reputation: 387

As far as i can see, you could just use the normal Calendar 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.

Upvotes: 20

Related Questions