简体   繁体   中英

android studio 3.0 stuck at “building gradle project info”

Today I was going to make a new project in Android Studio. The Android Studio on my computer is updated to 3.0. When I was creating a new project and finished the procedure of the settings, the AS stuck at "Building Gradle Project info".

I have met this situation several times in AS 2.3.3, and I solved them by modifying the gradle distributionUrl. But this time, it doesn't work.

I hope someone can give me a hand. Thanks anyway!

Because downloading Gradle takes a lot of time when your network situation is not so good, you have to download it by yourself.

My solution is:

1. Download a new version of gradle , such as gradle-4.3-all.zip, etc., and put the file in your AS Gradle location ( Mac : go to the Application folder and open the package of AS, and put the new gradle in the Gradle folder. PS: If your new gradle version folder is not found, then you can create it on your own. Windows : like the previous two answers);
2. Disconnect your Wifi or LAN;
3. Open Android Studio 3.0 as usual;
4. DO NOT OPEN YOUR PROJECT IMMEDIATELY, TURN TO THE PREFERENCE PART FIRST;
5. GO TO THE GRADLE PART, DO THE SETTINGS AND SWITCH THE OFFLINE MODE ON;
6. Open the project you want to open;
7. Let AS to index the file and modify the gradle.properties when it is still indexing.
8. Turn on you Wifi or LAN, and AS will download the missing file. ATTENTION: DO NOT MODIFY YOUR ANDROID MANIFEST OR OTHER FILES WHEN DOWNLOADING
9. Close AS and reopen the project. And everything will be fine. :-)

If you still stuck at "Building Gradle Project info", just redo all of these. Still not clear? Comment below.

Solution :

1). Delete the C:\\Users\\username.gradle folder

2). Download http://downloads.gradle.org/distributions/gradle-4.2.1-all.zip

3). Create a new project in android studio.

4). When this time it stucks at gradle building, Force close the android studio.

5) Now go to C:\\Users\\username.gradle\\wrapper\\dists\\gradle-2.2.1-all\\c64ydeuardnfqctvr1gm30w53 (the end directory name may be different)

6) Delete gradle-2.2.1-all.zip.lck and other files from this directory.

7) Paste the new downloaded gradle-2.2.1-all.zip here.

8) Run the android studio. :)

Problem

AS 3.0 is trying to download a new version of gradle but it is taking too much time.

Solution

  1. Make sure to close AS 3.0
  2. Go to the folder: C:\\Users\\[username]\\.gradle\\wrapper\\dists
  3. Note the latest version of gradle present there ( gradle-4.1-all in my case)
  4. Go to http://downloads.gradle.org/distributions and download the zip archive for this exact version ( gradle-4.1-all.zip in my case)
  5. Copy the archive in this gradle sub-folder, something like : C:\\Users\\[username]\\.gradle\\wrapper\\dists\\gradle-4.1-all\\c64ydeuardnfqctvr1gm30w53 ; delete the file with .part extension in this folder, it is the one AS 3.0 was trying to download.
  6. Unzip the downloaded archive in this folder.
    • Create a copy of the present .lck file (0 KB) with the .ok extension ( gradle-4.1-all.zip.ok in my case). I noticed that there are .ok files in other gradle version folders but I do not know if this is necessary.
  7. Run AS 3.0, it should be fine now.

Problem

  1. Android Studio 3.0 or later is trying to download a new version of gradle automatically but it is taking too much time

  2. During download time network issue can stuck at building gradle project info

image sample

Solution for Microsoft Windows 7,8,10

  1. Make sure to close Android Studio 3.0 or later version
  2. Go to gradle folder:
    C:\\Users[username]\\.gradle\\wrapper\\dists\\bzyivzo6n839fup2jbap0tjew\\ <== this long name folder can differ on your computer
    Delete the zip archive and extracted folder name contain gradle-4.1-all.zip and gradle-4.1
  3. Note the latest version of gradle present there (gradle-4.1-all in my case)
  4. Go to gradle download link: https://services.gradle.org/distributions/
    Download the zip archive for this exact version (gradle-4.1-all.zip in my case)
  5. Go to Download location of gradle-4.1-all.zip and
  6. Copy gradle-4.1-all.zip archive to following location
    C:\\Users[username]\\.gradle\\wrapper\\dists\\bzyivzo6n839fup2jbap0tjew\\ <== this long name folder can differ on your computer and paste it
    it is the one Android Studio 3.0 was trying to download.
  7. Extract gradle-4.1-all.zip after extraction complete you can find folder name called gradle-4.1
  8. Run Android Studio 3.0, it should be fine now.

如果您使用的是Windows,请尝试以管理员身份运行Android Studio

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