Fatal Exception: java.lang.NoSuchMethodError for org.apache.commons.lang3.tuple.Pair

2.6k views Asked by At

I need to compare two custom objects which are complex. Instead of overriding the equals method I used the apache.commons.lang3 method EqualsBuilder.reflectionEquals(obj1, obj2).

It works all fine on most of the Android devices. But for Xiaomi the application crashes with the below exception:

Fatal Exception: java.lang.NoSuchMethodError: No static method b(Ljava/lang/Object;Ljava/lang/Object;)Lorg/apache/commons/lang3/tuple/Pair; in class Lorg/apache/commons/lang3/tuple/Pair; or its super classes (declaration of 'org.apache.commons.lang3.tuple.Pair' appears in /system/framework/framework.jar)
   at org.apache.commons.lang3.builder.EqualsBuilder.getRegisterPair(EqualsBuilder.java:141)
   at org.apache.commons.lang3.builder.EqualsBuilder.isRegistered(EqualsBuilder.java:159)
   at org.apache.commons.lang3.builder.EqualsBuilder.reflectionAppend(EqualsBuilder.java:537)
   at org.apache.commons.lang3.builder.EqualsBuilder.reflectionAppend(EqualsBuilder.java:506)
   at org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals(EqualsBuilder.java:433)
   at org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals(EqualsBuilder.java:386)
   at org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals(EqualsBuilder.java:325)
   at 

I have the below line in gradle with version:

 implementation 'org.apache.commons:commons-lang3:3.8'

I am not sure what is going wrong and why it would fail on few devices and works all fine on others.

0

There are 0 answers