要么无法在 Android Studio 中安装或导入 Volley

我正在尝试使用 Volley 库在 Android 应用程序中发出网络请求,但安装/使用 Volley 的说明不起作用(我正在遵循本指南)。


当我将此添加到我的应用程序build.gradle依赖项并同步时


compile 'com.android.volley:volley:1.1.1'

Android Studio 给了我这个错误:


Gradle sync failed: Could not find method compile() for arguments [com.android.volley:volley:1.1.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Consult IDE log for more details (Help | Show Log) (10s 809ms)

我尝试更改compile为classname并且同步似乎有效,但我似乎仍然无法使用/导入 Volley 类。虽然我不知道我应该导入什么,因为出于某种原因它被排除在指南之外。Android Studio 似乎不知道依赖项,因为它没有提供任何添加导入的选项:

http://img3.mukewang.com/6125a47400011c6507270267.jpg

为什么这不起作用?我试过清理项目并重新启动 Android Studio。


拉丁的传说
浏览 378回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java