Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception android java.util.Objects in Android Version 4.3

i'm getting issues with running my app in a device (android 4.3) and i'm getting this error : E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NoClassDefFoundError: java.util.Objects

I know that The exception is thrown because all static methods of java.util.Objects are available above API 19 (Android 4.4.+) so that method doesn't exist in that Android version and NoClassDefFoundError is thrown.

But i also need my app to be compatible with version 4.3, how can i fix it ?

trace : java.lang.NoClassDefFoundError: java.util.Objects at okhttp3.CertificatePinner.withCertificateChainCleaner(CertificatePinner.java:231) at okhttp3.OkHttpClient.(OkHttpClient.java:238) at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)

like image 698
anonymous Avatar asked Dec 22 '22 23:12

anonymous


1 Answers

You are probably using OkHttp 3.13.x or higher 3.13.0 is the first release of OkHttp that bumps minimum requirements to Android 5+ API 21

Please try the 3.12.3 version as it should support devices with Android 2.3+ (API 9+)

Source: https://square.github.io/okhttp/changelog_3x/#version-3130

like image 72
mdev Avatar answered Dec 25 '22 22:12

mdev