Search code examples
androidsupercsv

java.lang.NoSuchMethodError: java.lang.String.isEmpty


I am using an external library called superCSV and this library apparently makes use of isEmpty. After a search on SO, I found that this method was introduced in 2.3 and indeed the crash I am getting is from 2.2

Is there anyway I can fix it that while still using the library? Perhaps provide an implementation of isEmpty? or somehow get it not to crash? Thank you


Solution

  • Are you using the latest version of SuperCSV?
    This has been fixed with SuperCSV 2.0.1 (and higher) by restoring Java 5 compatibility.

    You can see the related commit here: http://sourceforge.net/p/supercsv/code/264/

    Instead of calling java.lang.String.isEmpty() the library is now doing a simple check for String.length() == 0. That should fix your problem.