简体   繁体   English

Android Studio安装不适用于gradle

[英]Android Studio installation doesn't work with gradle

I am absolute beginner with Android Studio (especially Gradle) and having big trouble getting Android Studio to work. 我是Android Studio(特别是Gradle)的绝对初学者,并且在使Android Studio工作方面遇到了很大的麻烦。 I downloaded and installed the most recent version of Android Studio (0.8.0). 我下载并安装了最新版本的Android Studio(0.8.0)。 I have set the JDK_HOME variable. 我已经设置了JDK_HOME变量。 However, after I create a new project, I always receive the following message: 但是,在我创建一个新项目后,我总是收到以下消息:

Error:Unknown host 'jcenter.bintray.com'. 
Enable Gradle 'offline mode' and sync project.
Learn about configuring HTTP proxies in Gradle

If I try to compile the project, I get the following message dialog: 如果我尝试编译项目,我会得到以下消息对话框:

在此输入图像描述

After reading a post, I manually downloaded the Gradle binaries (latest, 2.0), extracted it onto the local drive, went to Settings and set the Gradle path to the respective directory using the following: 阅读帖子后,我手动下载了Gradle二进制文件(最新版本,2.0版),将其解压缩到本地驱动器上,转到“设置”并使用以下内容将Gradle路径设置为相应的目录:

在此输入图像描述

I also tweaked the build.gradle file under the project to point to the latest Gradle 2.0 version. 我还调整了项目下的build.gradle文件,指向最新的Gradle 2.0版本。 However, now I get the following error message: 但是,现在我收到以下错误消息:

Error:A problem occurred configuring root project 'HelloAndroidStudio'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.0.+.
Required by:
  :HelloAndroidStudio:unspecified
    Failed to list versions for com.android.tools.build:gradle.
    Unable to load Maven meta-data from     http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
    Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
    jcenter.bintray.com

Please can someone help. 请有人帮忙。 Being my first time with Gradle, I have been trying for so many days without any clue to the problem. 作为我第一次参加Gradle,我已经尝试了这么多天而没有任何线索来解决这个问题。 Thanks. 谢谢。

Change the Gradle version to lower ones and restart the Android Studio, you may get it. 将Gradle版本更改为较低版本并重新启动Android Studio,您可以获得它。

Add this in build.gradle classpath 'com.android.tools.build:gradle:1.1.0' 在build.gradle类路径'com.android.tools.build:gradle:1.1.0'中添加它

在外观和行为 - >系统设置 - > http代理下设置http_proxy解决了这个问题

Change to the latest classpath in the dependencies. 更改为依赖项中的最新类路径。 For AS 1.5.1 I will do like this : 对于AS 1.5.1,我会这样做:

buildscript {
repositories {
    jcenter()
  }

dependencies {
    **classpath 'com.android.tools.build:gradle:1.5.0'**
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM