Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Volley NoClassDefFoundError

We have recently updated our app to targetSDK 28. It has been working fine, but one user keeps getting a crash as soon as he runs the application. Here it is, as seen on our google play crash reports:

java.lang.NoClassDefFoundError: 
at com.android.volley.toolbox.HurlStack.performRequest (HurlStack.java:109)
at com.android.volley.toolbox.BasicNetwork.performRequest (BasicNetwork.java:97)
at com.android.volley.NetworkDispatcher.run (NetworkDispatcher.java:114)
Caused by: java.lang.ClassNotFoundException: 
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)

It is happening for a Sony Xperia, Android 9. It seems to be related to a call we do as soon as the app opens (volley), but we cannot reproduce the issue internally so its hard to pinpoint exactly what is going on.

How can I solve this?

Update: Ok, so this is a wild shot in the dark, but according to this I need to update my manifest: https://developers.google.com/maps/documentation/android-sdk/config#specify_requirement_for_apache_http_legacy_library

We do use google play services for location, so hoping this fixes this issue. Will update later.

like image 617
Zee Avatar asked Feb 14 '26 01:02

Zee


1 Answers

Solution: Put

< uses-library
android:name="org.apache.http.legacy"
android:required="false" />

In the Application object in the AndroidManifest.

like image 66
Zee Avatar answered Feb 16 '26 15:02

Zee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!