简体   繁体   English

Android Studio 2.2坚持使用建筑Gradle项目信息导入现有项目

[英]Android Studio 2.2 Stuck at Building Gradle Project Info on importing existing project

I am using Android studio 2.2 on windows 10. 我在Windows 10上使用Android studio 2.2。

I am trying to import an existing android project. 我正在尝试导入现有的android项目。 The problem that it took forever and still showing the message 它需要永远的问题,仍然显示消息

Building 'ProjecTName' Graedle project info 构建'ProjecTName'Graedle项目信息

after that android studio is totally getting stuck and i kill it from the task manager ! 之后,android工作室完全陷入困境,我从任务管理器中杀了它!

I tried the available options on Android Studio list: 我尝试了Android Studio列表中的可用选项:

  1. Open an existing Android Studio Project 打开现有的Android Studio项目

  2. Import Project (Eclipse ADT, Gradle, etc.) 导入项目(Eclipse ADT,Gradle等)

测试

There is downloading of Gradle going on at the background. 在后台有Gradle的下载。 Just wait for it to finish. 等待它完成。

Just Remove Gradle files from your project folder and retry. 只需从项目文件夹中删除Gradle文件,然后重试。

Hope this will help. 希望这会有所帮助。

I also had the problem. 我也有问题。

I downloaded the gradle 3.5 binary distribution zip file, deleted the gradle folder from my project, then went to settings of Android Studio, checked "Offline work", used "Use local gradle distribution" and set the path of unzipped gradle folder on the "Gradle home" and "Service directory path" text fields. 我下载了gradle 3.5二进制分发zip文件,从我的项目中删除了gradle文件夹,然后进入Android Studio设置,选中“离线工作”,使用“使用本地gradle分发”并设置解压缩gradle文件夹的路径“ Gradle home“和”服务目录路径“文本字段。

Then I tried to open the project with Android Studio 2.3. 然后我尝试用Android Studio 2.3打开项目。

Then a message is shown and I pressed cancel to manually configure the gradle, then I located the unzipped gradle folder again. 然后显示一条消息,我按下取消手动配置gradle,然后我再次找到解压缩的gradle文件夹。 This solved my problem. 这解决了我的问题。

Try the following : 请尝试以下方法:

1> Try Removing(Deleting) the gradle files from the project folder and then re-try. 1>尝试从项目文件夹中删除(删除)gradle文件,然后重试。

2> Try to go into the android studio and then Files>Invalidate Caches/Restart and then try. 2>尝试进入android工作室,然后进入文件>无效缓存/重启,然后尝试。

3> If the above two don't work do check the gradle,android Studio versions and see if those need updating. 3>如果以上两个不起作用,请检查gradle,android Studio版本,看看是否需要更新。

4> Above 3 usually work for me , if it still persists, then you need to check the dependencies for the project. 4> 3以上通常对我有用,如果它仍然存在,那么你需要检查项目的依赖关系。 Also try importing some other project and if the same issue occurs, try a new installation of a STABLE version of the android studio. 还尝试导入其他一些项目,如果出现同样的问题,请尝试安装android studio的STABLE版本

我删除了所有gradle文件夹并将其从另一个项目复制并粘贴,这对我有用

尝试删除C:\\ Users \\ User.gradle

The above answers didn't work for me well. 以上答案对我不起作用。

I have several projects with different gradle versions, and whenever I tried to open a project the Android Studio started downloading its gradle in the background. 我有几个具有不同gradle版本的项目,每当我尝试打开一个项目时,Android Studio就开始在后台下载它的gradle。

So, things to do before importing old projects to new Android Studio / Gradle. 因此,在将旧项目导入新的Android Studio / Gradle之前要做的事情。

  1. In file 'build.gradle' replace old line with "classpath 'com.android.tools.build:gradle:2.3.3'" (Assuming 2.3.3 is the latest. You can check this in your newly/recently created project) 在文件'build.gradle'中将旧行替换为“classpath'com.android.tools.build:grad:2.3.3'”(假设2.3.3是最新版本。您可以在新近/最近创建的项目中检查这一点)
  2. In file 'gradle/wrapper/gradle-wrapper.properties' replace old line with 'distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip' (Assuming 3.3 is the latest. You can check this in your newly/recently created project) 在文件'gradle / wrapper / gradle-wrapper.properties'中用'distributionUrl = https://services.gradle.org/distributions/gradle-3.3-all.zip'替换旧行(假设3.3是最新的。你可以检查在你最近/最近创建的项目中)

Now when you'll import, it wont download other gradle version. 现在当你导入时,它不会下载其他gradle版本。

I did find-replace for the above lines in my whole directory containing all my old projects, using Notepad++. 我使用Notepad ++在包含所有旧项目的整个目录中找到了 - 替换上面的行。

Actually the real Problem is that the studio is downloading gradle files throught internet and sometimes it is not able to do so, then it stucks but we can manually fix it through- 实际上真正的问题是工作室正在通过互联网下载gradle文件,有时它无法这样做,然后它卡住但我们可以手动修复它 -

Download Gradle Files according to your android Studios version. 根据您的Android Studios版本下载Gradle文件。

You can download gradle files through- https://services.gradle.org/distributions/ 您可以通过https://services.gradle.org/distributions/下载gradle文件

See your Gradle vesrion through- https://developer.android.com/studio/releases/gradle-plugin.html in the Update Gradle area. 通过https://developer.android.com/studio/releases/gradle-plugin.html在Update Gradle区域中查看您的Gradle vesrion。

Download the Gradle and paste it into- c:/Users/username/local/.gradle 下载Gradle并将其粘贴到-c:/Users/username/local/.gradle中

and this is It!!! 这就是它!!!

I found that my gradle files had the gradle version set 2.1.0. 我发现我的gradle文件的gradle版本设置为2.1.0。 So I opened the files in wordpad and first changed that to 3.3 And then it worked fine for me. 所以我在wordpad中打开文件并首先将其更改为3.3然后它对我来说很好。

And in the gradel-wrapper.properties: From distributionUrl=https\\://services.gradle.org/distributions/gradle-2.10-all.zip To distributionUrl=https\\://services.gradle.org/distributions/gradle-3.3-all.zip Hope that will solve the problem 在gradelwrapper.properties中:from distributionUrl=https\\://services.gradle.org/distributions/gradle-2.10-all.zip to distributionUrl=https\\://services.gradle.org/distributions/gradle-3.3-all.zip希望能解决问题

This worked for me.. Will work for you for sure. 这对我有用..肯定会为你工作。

step 1: Delete "only" the Gradle "folder" from your project folder. 步骤1:从项目文件夹中“仅删除”Gradle“文件夹”。

step 2: Import your project from Android Studio & a dialog box will appear "press Ok to use..., or Cancel to... ". 第2步:从Android Studio导入您的项目,将出现一个对话框“按确定以使用...,或取消以...”。 Press "Cancel" & locate the path where you have downloaded the latest Gradle File (C:/Gradle/gradle-3.5 ,in my case). 按“取消”并找到已下载最新Gradle文件的路径(在我的例子中为C:/ Gradle / gradle-3.5)。

Step 3: it will give an error saying that "no cache version for....". 第3步:它会给出一个错误,说“没有缓存版本......”。 So now check which version of com.android.tools.build:gradle: you have.. so check the path "C:\\Program Files\\Android\\Android Studio\\gradle\\m2repository\\com\\android\\tools\\build\\gradle" and select the latest version (2.3.2 in my case). 所以现在检查哪个版本的com.android.tools.build:gradle:你有...所以检查路径“C:\\ Program Files \\ Android \\ Android Studio \\ gradle \\ m2repository \\ com \\ android \\ tools \\ build \\ gradle”并选择最新版本(在我的情况下为2.3.2)。 So now, go to Gradle Scripts-> build.gradle(android) in Android Studio and change the dependencie's classpath to (classpath 'com.android.tools.build:gradle:2.3.2')in my case 所以现在,在Android Studio中转到Gradle Scripts-> build.gradle(android),并在我的情况下将dependencie的类路径更改为(classpath'com.android.tools.build:gradle:2.3.2')

step 4: Click on "try again". 第4步:点击“再试一次”。 Then it'll ask for upgrading tools, upgrade it by clicking on it & then you're done.. 然后它会要求升级工具,通过点击它升级它然后你就完成了..

Congrats, your Project is successfully built.. 恭喜,您的项目已成功建成..

And yeah make sure that In Setting-> Build,Exec...->Gradle-> "check mark on Use local gradle distribution & offline work & Gradle home: C:/Gradle/gradle-3.5 & Service directory path: C:/Gradle/gradle-3.5 (in my case). 并且确保在设置 - >构建,执行...-> Gradle->“选中使用本地gradle分发和离线工作和Gradle home:C:/ Gradle / gradle-3.5&Service目录路径:C: /Gradle/gradle-3.5(在我的情况下)。

删除temp和temp%对我有用!

Download manually gradle-3.3-all.zip 手动下载gradle-3.3-all.zip

and extract into /Users/[yourUsername]/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/ 并提取到/Users/[yourUsername]/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/

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

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