简体   繁体   中英

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

I am using Android studio 2.2 on windows 10.

I am trying to import an existing android project. The problem that it took forever and still showing the message

Building 'ProjecTName' Graedle project info

after that android studio is totally getting stuck and i kill it from the task manager !

I tried the available options on Android Studio list:

  1. Open an existing Android Studio Project

  2. Import Project (Eclipse ADT, Gradle, etc.)

测试

There is downloading of Gradle going on at the background. Just wait for it to finish.

Just Remove Gradle files from your project folder and retry.

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.

Then I tried to open the project with 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. This solved my problem.

Try the following :

1> Try Removing(Deleting) the gradle files from the project folder and then re-try.

2> Try to go into the android studio and then Files>Invalidate Caches/Restart and then try.

3> If the above two don't work do check the gradle,android Studio versions and see if those need updating.

4> Above 3 usually work for me , if it still persists, then you need to check the dependencies for the project. Also try importing some other project and if the same issue occurs, try a new installation of a of the android studio.

我删除了所有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.

So, things to do before importing old projects to new 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)
  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)

Now when you'll import, it wont download other gradle version.

I did find-replace for the above lines in my whole directory containing all my old projects, using 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-

Download Gradle Files according to your android Studios version.

You can download gradle files through- https://services.gradle.org/distributions/

See your Gradle vesrion through- https://developer.android.com/studio/releases/gradle-plugin.html in the Update Gradle area.

Download the Gradle and paste it into- c:/Users/username/local/.gradle

and this is It!!!

I found that my gradle files had the gradle version set 2.1.0. So I opened the files in wordpad and first changed that to 3.3 And then it worked fine for me.

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

This worked for me.. Will work for you for sure.

step 1: Delete "only" the Gradle "folder" from your project folder.

step 2: Import your project from Android Studio & a dialog box will appear "press Ok to use..., or Cancel to... ". Press "Cancel" & locate the path where you have downloaded the latest Gradle File (C:/Gradle/gradle-3.5 ,in my case).

Step 3: it will give an error saying that "no cache version for....". 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). 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

step 4: Click on "try again". 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).

删除temp和temp%对我有用!

Download manually gradle-3.3-all.zip

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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