Objective
As you all know, Android Studio has now been updated to 2.0 Preview 6, and Google's highly prized development tool has incomparable advantages over eclipse ADT. However, in the actual use, there are still a lot of uncomfortable places. Android Studio native support uses Gradle to build a project this is a good idea to use the dynamic language groovy to define the project build process and avoid the tedious definition of the Build.xml file. However, the Gradle binary package is large, and users may follow a different version of the Gradle, and there may be a variety of problems with the build. Therefore, Gradle wrapper was put forward to solve the problems that arose before. Gradle Wrapper is bound to a specified gradle version. When a user imports a project project, the Gradle package is automatically downloaded to the remote server. This solves the problem of inconsistent client version, but also brings a new problem: Domestic connection to remote server download Gradle packet is very slow! So whenever a new project is imported into Android studio, it will be stuck in this interface:
You don't know exactly as dead, or what it does in the background ... You can either have a temper or just turn off the as, and must be forced off. This is a very unfriendly thing to do. In fact, the reason that you are stuck here is because the Gradle package is downloaded from the server in the background. And this gradle packet often has a few 10 trillion, in the network environment is not very good circumstances, it may take a long time to complete. Obviously, we don't have so much time to spend here, we need to find a way to solve it.
Solving method
On the web, the usual practice is to modify the Gradle version in the Gradle wrapper configuration file, but it is not complete. Finally, we see the solution to the complete point here. The following are several steps to streamline:
1, the first to obtain the relevant parameters of the machine, including the following (in parentheses are my own machine parameters):
Android Plugin Version: (1.5.0)
Gradle Version: (2.8)
Compile SDK Version: (23)
Build Tools Version: (23.0.2)
Gradlehome: (/applications/android studio.app/contents/gradle/gradle-2.8)
Getting the method is simple, create a new project in Android Studio, click the project name and select the Open Module Settings pop-up dialog box to see:
2. When the parameters are ready, you can begin to modify the parameters of the target project. What files are the parameters that need to be modified in?
Xxx-project/.idea/gradle.xml files: Adding or modifying<option name="gradleHome" value="前面的GradleHome参数" />
Xxx-project/gradle/wrapper/gradle-wrapper.properties file: distributionUrl=https\://services.gradle.org/distributions/gradle -Front ofgradleVersion-all.zip
Xxx-project/build.gradle file: classpath ‘com.android.tools.build:gradle: front Android Plugin Version‘ (This is the entire project configuration)
Xxx-project/build.gradle files: Modifying Compile SDK Version and Build Tools Version parameters. (This is a single module configuration, each module in project needs to be modified)
3. The parameter modification completes, starts formally to import the project. In general, this can be a good time to import into the Android studio. If still stuck in the import interface, then only obediently wait ...
Summarize
The above is the entire content of this article, I hope to use the Android studio time to bring some help, if there are questions you can message exchange.