android - "No cached version... available for offline mode."

标签 android android-studio gradle android-gradle-plugin

我在 Android Studio 中构建新的 Hello World 项目时收到一条错误消息:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'MyApplication2'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:0.9.1.
     Required by:
         :MyApplication2:unspecified
      > No cached version of com.android.tools.build:gradle:0.9.1 available for offline mode.

BUILD FAILED

Android Studio 版本:0.5.2

Gradle 版本:0.9.1

我正在使用代理连接到 Internet。

最佳答案

今天更新 Android Studio 后出现同样的错误。对我来说,这不是代理设置的问题:

  1. 在 Android Studio 0.6.0 中取消勾选“离线工作”:

    文件->设置->Gradle->全局Gradle设置

    或在 OSX 中:

    首选项->Gradle->全局Gradle设置

    或更新的版本:

    文件->设置->构建、执行、部署->构建工具->Gradle

  2. 重新同步项目,例如重启 Android Studio

  3. 同步后,您可以再次选中该选项以脱机工作。

(仅在 Gradle 0.11 版...和 ​​Android Studio 0.6.0 预览版中测试)

编辑:为不同版本/平台添加了路径(如 John BallingerThe_Martian 所述)。尚未验证。

关于android - "No cached version... available for offline mode.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22607661/

相关文章:

Android:如何使用 MediaMetadataRetriever 获取图像?

java - 为什么我得到一个 null 对象?

android - flutter build apk --release 构建 apk 文件但在 Android 上安装后出现错误

android - 在 Android Studio 中导入 scribe-1.2.1.jar

android - 更新 Android Studio 后 Gradle 构建错误

java.lang.ClassNotFoundException : Cannot find implementation for 异常

Android:如何以编程方式直接调用 PIN 屏幕?

android - Nexus 4 上的极端相机延迟

android-studio - 如何在没有StatefulWidget的情况下使用setState?

android-studio - com.google.android.youtube.player.youtubeplayerviewmodestbranding被禁用或隐藏在android中