Android studio has been stuck in gradle: several solutions to build running

When using as to develop Android applications, we often encounter the situation that gradle build running is running all the time or even stuck. The solutions are as follows:

Method 1:

1. Create a new gradle.properties file in C: \ user \ < user name > \. Gradle directory and add a line: org. Gradle. Daemon = true

2. Open as and set the gradle's working mode to offline in settings, as shown in the following figure:

This will solve the problem of running all the time

Method 2:

Find the path C: \ users \ admin \. Gradle \ wrapper \ dists. Under this folder, there is a gradle version folder. After opening, there is a folder with a long name, such as my C: \ users \ admin \. Gradle \ wrapper \ dists \ gradle-2.4-all \ 6r4uqcc6ovnq6ac6s0txzcpc0, then download the corresponding version of gradle, and put the downloaded compressed package directly into the folder with a long name, No decompression is required

Method 3:

You need to configure gradle's agent in Android studio. Of course, goagent is used. Open setting - > gradle - > gradle VM options: - dhttp. Proxyhost = 127.0.0.1 - dhttp. Proxyport = 8087. After setting successfully, restart Android studio. The speed will be very fast.

Method 4:

1) Enter the bin directory under the newly installed Android studio directory. Locate the idea.properties file and open it with a text editor.

2) Add a line at the end of the idea. Properties file: disable. Android. First. Run = true, and then save the file.

3) Close Android studio and restart to enter the interface.

Method: 5:

It may be caused by some domestic anti-virus software disabling the aapt.exe process. AAPT, Android asset packaging tool, is in the build tools directory of the SDK. The tool can view, create and update document attachments (zip, jar, APK) in ZIP format. You can also compile resource files into binary files. Although you may not have directly used the AAPT tool, build scripts and IDE plug-ins will use this tool to package APK files to form an Android application.

terms of settlement:

There is a solution on the Internet by extending the startup time of aapt.exe. Add "slave_aapt_timeout" to the system variable and set the value to 30. At the same time, add "java_home" to the user variable. However, I believe that anyone who develops Java or Android will set "java_home"

Another way is to update build tools to the latest version

However, the above methods can solve the symptoms but not the root causes

The fundamental solution is to make the antivirus software trust all the operations of Android studio

This requires you to add trust programs according to the anti-virus software you use on your computer. The specific process depends on the software you use

Add studio.exe (32-bit) or studio64.exe (64 bit) as a trust program. These two files are in the \ bin folder of the installation directory of Android studio

Or set the entire Android studio installation directory folder as the trust zone directly

If the above steps are troublesome, close or completely uninstall the anti-virus software to... Simple and effective

Method 6:

Download a newer version of Android studio. The new version has a good improvement on this situation. I used 2.2.3, almost no Caton.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>