java.lang.NoSuchMethodError: No interface method sort(Ljava/util/Comparator;) exception in sorting arraylist android

ArrayList#sort() was added in API level 24 and runtimes below API level 24 don't have that method. Looks like your compileSdkVersion is at 24 so you got the code to compile in the first place.

Use Collections.sort(list, comparator) instead.


If you get this error in the Zxing core lib in you can solve it by downgrading Zxing to 3.3.x (3.3.3 currently).

See for details.

What if you try

Collections.sort(eventsList, new Comparator...

As far as I know ArrayList doesn't have sort method.