JSoup 1.6.0 on Android throws Exception: String.isEmpty() NoSuchMethodExists
I'm trying to use JSoup 1.6.0 with my Android application and it throws a NoSuchMethodExists exception.
This other question tells me that isEmpty() was not added to Java JRE until 1.6 -- I've checked my JRE in ecl开发者_如何转开发ipse, and it is 1.6, however when I try to run my app on my emulator it throws the above exception. Is there a fix, or should I just import the Apache Commons Lang library?
String.isEmpty()
isn't available until API level 9. Instead, you can use TextUtils.isEmpty()
.
It looks like JSoup 1.6 introduced code that uses String.isEmpty()
and therefore will require Android API level 9. I would suggest using an older release of JSoup for now if you are targeting Android API level 8 or lower (Froyo).
This is being treated as a bug in JSoup 1.6.0 and you can expect a fix soon. See https://github.com/jhy/jsoup/issues/103 for status.
精彩评论