Resolve! java.lang.ClassNotFoundException: Didn’t find class “org.apache.http.ProtocolVersion” Volley Issue with targetSdkVersion 26 to 28

A few days back I was trying to upload the latest version on my Android application to Playstore when I faced this upload error:

Saying: Your app currently targets API level 26 and must target at least API level 28 to ensure it is built on the latest APIs optimized for security and performance.

Ok so not a big deal, Just change the number and we are done!

But wait, the change in compileSdkVersion and targetSdkVersion from 26 to 28 in build:gradle(:app)  caused a new problem when making HTTP calls using Volley library(v1.0.17 or v1.1.0) in the application.

When making the HTTP Get a call in a real device it was shown below error and crashing the app.

E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/app/"],nativeLibraryDirectories=[/data/app/, /data/app/!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(

So after spending some hours of debugging and looking for online help, I found a solution and also got to know about the issue with this.

What caused this issue?

As explained in Google forums here:

Specify requirement for Apache HTTP Legacy library

If you are using or below and your app is targeting API level 28 (Android 9.0) or above, you must include the following declaration within the <application> element of AndroidManifest.xml.

The solution to this problem

As explained here jus add the following line

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

In the AndroidManifest.xml file under <application> as shown below:

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

After adding the above change, the application was uploaded successfully in play store

Hope this will save your time in a similar situation 🙂

Notify of
Inline Feedbacks
View all comments