在 andorid.jar 中找不到 android.net.http.RequestQueue

标签 android

我正在开发 Android Twitter 应用程序。我下载了 TwitterClient Demo deom net。 但是在android.jar中的sDK组件中有一个class文件“android.net.http.RequestQueue”是没有的。请就此提出建议。

最佳答案

这取决于您从何处下载了该 Twitter 演示示例:

Twitter client example

android.net.http.RequestQueue is not an official part of the Android API, so it might go away or change in a future release.
You can tell by the {@hide} in the class-level JavaDoc comment in RequestQueue.java.

因此,如果最近的 API 不再有此类,您可以回退到 HttpURLConnection,如 this thread .

It seems safer to use the good ol' HttpURLConnection for HTTP calls then.
I suppose the RequestQueue was offered to save us the effort of spawning a separate thread before making the HTTP calls.

参见 this tutorial here 中说明的两种方法.

关于在 andorid.jar 中找不到 android.net.http.RequestQueue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2839366/

相关文章:

android - 如何使用 google maps api 获得速度限制?

java - 测试我的 Java/Android 应用程序 - 我的设置是否错误?

android - FirebaseDatabase.getInstance().reference 中的问题

Android - 检查APP是否已经安装

android - Gradle错误无法解决:com.github.Binary-Finery:Bungee:master-SNAPSHOT

android - 不允许用户单击其中一个选项卡

java - 如何在数据库中保存复选框状态?

android - 拦截 NavigationUI.onNavDestinationSelected() 使 backstack 弹出 "inclusive = true"

Android Toolbar 设置标题解释

java - android 上的 3ds 动画