Search code examples
javaandroidmopub

MoPub Android HttpResponse cannot be resolved


I'm using mopub sdk 4.8.0. I included the following libraries, as it says in documentation:

android-support-v4.jar,
android-support-annotations.jar,
android-support-v7-recyclerview.jar,
mopub-volley-1.1.0.jar

But when I build the project, following errors are written to Logcat:

The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required .class files RequestQueueHttpStack.java /mopub-sdk/src/com/mopub/network line 1 Cannot find the class file for org.apache.http.HttpResponse.

What libraries do I need to add?


Solution

  • org.apache.http has been deprecated for a while now and since API Level 23 (Android 6.0) it's not among Androids default dependencies anymore.

    It's still available but you need to add the dependency to your Apps build.grandle file like so:

    android {
    
        ....
    
        useLibrary 'org.apache.http.legacy'
    }
    

    some more infos about it can be found here: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client