I am getting following Exception on Android 2.2.1:
java.lang.NoSuchMethodError: java.lang.String.isEmpty
I am calling text.isEmpty
from Scala. Any idea, how to solve this?
NoSuchMethodError is a runtime error in Java which occurs when a method is called that exists at compile-time, but does not exist at runtime. The Java Garbage Collector (GC) cannot free up the space required for a new object, which causes a java. lang. OutOfMemoryError .
NoSuchMethodError: main Exception in thread "main" can come due to various reasons like: 1) The class which you are trying to run doesn't have the main method. 2) The signature of the main method is not correct. See here for all possible signatures of the main method in Java.
java.lang.String.isEmpty()
was added in Gingerbread (2.3). You will have to write your own replacement function...
Use JRE/JDK 1.5, which did not have an isEmpty
method on String
. This will avoid situations where Scala uses 1.6's isEmpty
instead of its own. If you have Java libraries as well, be sure to pick ones compatible with 1.5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With