MoPub Android 无法解析 HttpResponse

MoPub Android HttpResponse cannot be resolved

我正在使用 mopub sdk 4.8.0。正如 documentation 中所说,我包含了以下库:

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

但是当我构建项目时,以下错误被写入 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.

我需要添加哪些库?

org.apache.http 已经弃用一段时间了,因为 API 级别 23 (Android 6.0) 它不在 Android不再是默认依赖项。

它仍然可用,但您需要将依赖项添加到您的 Apps build.grandle 文件中,如下所示:

android {

    ....

    useLibrary 'org.apache.http.legacy'
}

可以在此处找到有关它的更多信息:https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client