无法在android studio中导入新的Gradle项目

时间:2023-01-17 13:57:50

I got the error when i create a new Project using android studio. below i attached a screenshots of error message..无法在android studio中导入新的Gradle项目 I am using windows 7 (64 bit) Please help me.

当我使用android studio创建一个新项目时,我收到了错误。下面我附上了错误信息的截图..我使用的是Windows 7(64位)请帮帮我。

11 个解决方案

#1


32  

I also had an issue downloading gradle through AndroidStudio. I tried the following.

我也有问题通过AndroidStudio下载gradle。我尝试了以下内容。

  1. Go to your AndroidStudio directory where you installed your studio Like D:\User\AndroidStudio
  2. 转到安装工作室的AndroidStudio目录,如D:\ User \ AndroidStudio
  3. In AndroidStudio go to \AndroidStudio\plugins\gradle\lib and copy gradle.jar
  4. 在AndroidStudio中,转到\ AndroidStudio \ plugins \ gradle \ lib并复制gradle.jar
  5. Paste gradle.jar file in \AndroidStudio\lib directory.
  6. 将gradle.jar文件粘贴到\ AndroidStudio \ lib目录中。
  7. Download gradle directly from Gradle
  8. 直接从Gradle下载gradle
  9. Copy the contents of gradle-1.6-bin.zip - After extracting zip file - (bin, media, init.d, lib folders) to \AndroidStudio\plugins\gradle
  10. 复制gradle-1.6-bin.zip的内容 - 将zip文件 - (bin,media,init.d,lib文件夹)解压缩到\ AndroidStudio \ plugins \ gradle后
  11. Restart AndroidStudio
  12. 重启AndroidStudio

* Updated Answer *

*更新答案*

And after following all the steps listed above, if it is not working, Kindly check below things.

按照上面列出的所有步骤操作后,如果不能正常工作,请检查以下内容。

1) Please delete .gradle folder from your user like C:\Document and Settings\AndroidUser\***\.gradle

1)请删除用户的.gradle文件夹,如C:\ Document和Settings \ AndroidUser \ *** \。gradle

2) You can check your HTTP Proxy in Settings.

2)您可以在“设置”中检查HTTP代理。

Hope this helps!

希望这可以帮助!

#2


28  

In my case, it was sufficient to specify the location of the Gradle distribution included with Android Studio when requested.

就我而言,只要在请求时指定Android Studio附带的Gradle发行版的位置就足够了。

On a mac, it was: /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1
On Linux, it can be generalized to {android-studio-root}/grade/gradle-{version}

在Mac上,它是:/ Applications / Android Studio.app/Contents/gradle/gradle-2.2.1在Linux上,它可以推广到{android-studio-root} / grade / gradle- {version}

#3


10  

  1. First Create a New Project "your_project"
  2. 首先创建一个新项目“your_project”
  3. When the above stated error appears click ok
  4. 出现上述错误时,单击“确定”
  5. Now go to IMPORT-> "your_project " and follow the instruction
  6. 现在转到IMPORT->“your_project”并按照说明操作
  7. Your Project Is Created
  8. 您的项目已创建

#4


4  

Download gradle, and replace it with the file gradle-1.6-bin.zip located at: C:\Users\<username>\.gradle\wrapper\dists\gradle-1.6-bin\<some_hash_key>\

下载gradle,并将其替换为位于以下位置的文件gradle-1.6-bin.zip:C:\ Users \ <用户名> \ .gradle \ wrapper \ dists \ gradle-1.6-bin \ \

#5


2  

If Android Studio offers you to choose home folder for gradle, just choose "Use customizable gradle". Then, if you see only gradle files, but no classes and resources - click on "Synchronize gradle" and it will be alrigth. Hope this helps

如果Android Studio允许您为gradle选择主文件夹,只需选择“使用可自定义的gradle”。然后,如果您只看到gradle文件,但没有看到任何类和资源 - 请单击“Synchronize gradle”,它将是alrigth。希望这可以帮助

#6


1  

For me, this issue only occurs when using a proxy server. If you specify a proxy server in the settings, everything is working fine for me. You can specify a proxy server by File->Settings->HTTP Proxy

对我来说,只有在使用代理服务器时才会出现此问题。如果您在设置中指定代理服务器,一切都正常。您可以通过File-> Settings-> HTTP Proxy指定代理服务器

#7


1  

If you using ubuntu behind a proxy, in my case I'm using ctlm, you must change the jetbrains' proxy setting in /Home/UserName/.AndroidStudioPreview/config/options/other.xml

如果你在代理后面使用ubuntu,在我的情况下我使用的是ctlm,你必须在/Home/UserName/.AndroidStudioPreview/config/options/other.xml中更改jetbrains的代理设置

<option name="USE_HTTP_PROXY" value="true" />
<option name="PROXY_HOST" value="localhost" />
<option name="PROXY_PORT" value="8080" />

This is my configuration I don't need autentificated user.

这是我的配置我不需要autentificated用户。

bests Regards

祝贺你

#8


1  

Had the same problem I think because our internet set-up blocked access to https://dl-ssl.google.com site.I resolved in by downloading gradle 1.6 zip then extracted it in some folder.go to File --> Settings --> click option-->Gradle ,the check use local gradle distribution and point it to the extracted directory eg C:\android-studio\plugins\gradle\gradle-1.6-bin\gradle-1.6 Then it was okay

我认为有同样的问题,因为我们的互联网设置阻止访问https://dl-ssl.google.com site.I解决了通过下载gradle 1.6 zip然后将其解压缩到某个文件夹。来到文件 - >设置 - >单击选项 - > Gradle,检查使用本地gradle分发并将其指向解压缩的目录,例如C:\ android-studio \ plugins \ gradle \ gradle-1.6-bin \ gradle-1.6然后就可以了

#9


0  

We have to change the android sdk source in the project settings to our sdk where we have installed the android build tools.

我们必须将项目设置中的android sdk源更改为我们安装了android构建工具的sdk。

I had the same issue and by doing this, it worked. Thanks.

我有同样的问题,通过这样做,它工作。谢谢。

#10


0  

While importing the project I specified the location of the Gradle distribution.

导入项目时,我指定了Gradle分布的位置。

On Windows 7 it was here:

在Windows 7上,它在这里:

C:\Program Files\Android-Studio\gradle\gradle-2.2.1

#11


0  

Check your proxy setting for gradle. If it still fails after set the HTTP Proxy in setting menu, you may add gradle.properties as following.

检查代理设置是否为gradle。如果在设置菜单中设置HTTP代理后仍然失败,则可以添加gradle.properties,如下所示。

First, go to the project directory. (By default-for Windows-, projects will be created to {user}\AndroidStudioProjects\{ProjectName}). And then create gradle.properties file as below.

首先,转到项目目录。 (默认情况下 - 对于Windows-,项目将创建到{user} \ AndroidStudioProjects \ {ProjectName})。然后创建gradle.properties文件,如下所示。

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

you can also refer to the User's guide.

您也可以参考用户指南。

#1


32  

I also had an issue downloading gradle through AndroidStudio. I tried the following.

我也有问题通过AndroidStudio下载gradle。我尝试了以下内容。

  1. Go to your AndroidStudio directory where you installed your studio Like D:\User\AndroidStudio
  2. 转到安装工作室的AndroidStudio目录,如D:\ User \ AndroidStudio
  3. In AndroidStudio go to \AndroidStudio\plugins\gradle\lib and copy gradle.jar
  4. 在AndroidStudio中,转到\ AndroidStudio \ plugins \ gradle \ lib并复制gradle.jar
  5. Paste gradle.jar file in \AndroidStudio\lib directory.
  6. 将gradle.jar文件粘贴到\ AndroidStudio \ lib目录中。
  7. Download gradle directly from Gradle
  8. 直接从Gradle下载gradle
  9. Copy the contents of gradle-1.6-bin.zip - After extracting zip file - (bin, media, init.d, lib folders) to \AndroidStudio\plugins\gradle
  10. 复制gradle-1.6-bin.zip的内容 - 将zip文件 - (bin,media,init.d,lib文件夹)解压缩到\ AndroidStudio \ plugins \ gradle后
  11. Restart AndroidStudio
  12. 重启AndroidStudio

* Updated Answer *

*更新答案*

And after following all the steps listed above, if it is not working, Kindly check below things.

按照上面列出的所有步骤操作后,如果不能正常工作,请检查以下内容。

1) Please delete .gradle folder from your user like C:\Document and Settings\AndroidUser\***\.gradle

1)请删除用户的.gradle文件夹,如C:\ Document和Settings \ AndroidUser \ *** \。gradle

2) You can check your HTTP Proxy in Settings.

2)您可以在“设置”中检查HTTP代理。

Hope this helps!

希望这可以帮助!

#2


28  

In my case, it was sufficient to specify the location of the Gradle distribution included with Android Studio when requested.

就我而言,只要在请求时指定Android Studio附带的Gradle发行版的位置就足够了。

On a mac, it was: /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1
On Linux, it can be generalized to {android-studio-root}/grade/gradle-{version}

在Mac上,它是:/ Applications / Android Studio.app/Contents/gradle/gradle-2.2.1在Linux上,它可以推广到{android-studio-root} / grade / gradle- {version}

#3


10  

  1. First Create a New Project "your_project"
  2. 首先创建一个新项目“your_project”
  3. When the above stated error appears click ok
  4. 出现上述错误时,单击“确定”
  5. Now go to IMPORT-> "your_project " and follow the instruction
  6. 现在转到IMPORT->“your_project”并按照说明操作
  7. Your Project Is Created
  8. 您的项目已创建

#4


4  

Download gradle, and replace it with the file gradle-1.6-bin.zip located at: C:\Users\<username>\.gradle\wrapper\dists\gradle-1.6-bin\<some_hash_key>\

下载gradle,并将其替换为位于以下位置的文件gradle-1.6-bin.zip:C:\ Users \ <用户名> \ .gradle \ wrapper \ dists \ gradle-1.6-bin \ \

#5


2  

If Android Studio offers you to choose home folder for gradle, just choose "Use customizable gradle". Then, if you see only gradle files, but no classes and resources - click on "Synchronize gradle" and it will be alrigth. Hope this helps

如果Android Studio允许您为gradle选择主文件夹,只需选择“使用可自定义的gradle”。然后,如果您只看到gradle文件,但没有看到任何类和资源 - 请单击“Synchronize gradle”,它将是alrigth。希望这可以帮助

#6


1  

For me, this issue only occurs when using a proxy server. If you specify a proxy server in the settings, everything is working fine for me. You can specify a proxy server by File->Settings->HTTP Proxy

对我来说,只有在使用代理服务器时才会出现此问题。如果您在设置中指定代理服务器,一切都正常。您可以通过File-> Settings-> HTTP Proxy指定代理服务器

#7


1  

If you using ubuntu behind a proxy, in my case I'm using ctlm, you must change the jetbrains' proxy setting in /Home/UserName/.AndroidStudioPreview/config/options/other.xml

如果你在代理后面使用ubuntu,在我的情况下我使用的是ctlm,你必须在/Home/UserName/.AndroidStudioPreview/config/options/other.xml中更改jetbrains的代理设置

<option name="USE_HTTP_PROXY" value="true" />
<option name="PROXY_HOST" value="localhost" />
<option name="PROXY_PORT" value="8080" />

This is my configuration I don't need autentificated user.

这是我的配置我不需要autentificated用户。

bests Regards

祝贺你

#8


1  

Had the same problem I think because our internet set-up blocked access to https://dl-ssl.google.com site.I resolved in by downloading gradle 1.6 zip then extracted it in some folder.go to File --> Settings --> click option-->Gradle ,the check use local gradle distribution and point it to the extracted directory eg C:\android-studio\plugins\gradle\gradle-1.6-bin\gradle-1.6 Then it was okay

我认为有同样的问题,因为我们的互联网设置阻止访问https://dl-ssl.google.com site.I解决了通过下载gradle 1.6 zip然后将其解压缩到某个文件夹。来到文件 - >设置 - >单击选项 - > Gradle,检查使用本地gradle分发并将其指向解压缩的目录,例如C:\ android-studio \ plugins \ gradle \ gradle-1.6-bin \ gradle-1.6然后就可以了

#9


0  

We have to change the android sdk source in the project settings to our sdk where we have installed the android build tools.

我们必须将项目设置中的android sdk源更改为我们安装了android构建工具的sdk。

I had the same issue and by doing this, it worked. Thanks.

我有同样的问题,通过这样做,它工作。谢谢。

#10


0  

While importing the project I specified the location of the Gradle distribution.

导入项目时,我指定了Gradle分布的位置。

On Windows 7 it was here:

在Windows 7上,它在这里:

C:\Program Files\Android-Studio\gradle\gradle-2.2.1

#11


0  

Check your proxy setting for gradle. If it still fails after set the HTTP Proxy in setting menu, you may add gradle.properties as following.

检查代理设置是否为gradle。如果在设置菜单中设置HTTP代理后仍然失败,则可以添加gradle.properties,如下所示。

First, go to the project directory. (By default-for Windows-, projects will be created to {user}\AndroidStudioProjects\{ProjectName}). And then create gradle.properties file as below.

首先,转到项目目录。 (默认情况下 - 对于Windows-,项目将创建到{user} \ AndroidStudioProjects \ {ProjectName})。然后创建gradle.properties文件,如下所示。

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

you can also refer to the User's guide.

您也可以参考用户指南。