When using IONIC 2, when you use the Android platform command or compile, you will always get the GRADLE, and wait for a long time to change, resulting in the order timeout fail. So after reviewing the information and its own practice, the following measures are summarized.
In fact, the reason is that the specified download path is used in the order of download (may not be described in this way, welcome everyone to criticize and correct), China This is very slow, even the time, which leads to the above problems.
So we go to download Gradle yourself, store it locally, then change the configuration file, make it downloaded online without online download, but obtained from our local location.
First we open this JS:
Your project name /platforms/android/cordova/lib/builders/gradlebuilder.js There is a default definition for DistributionURL:
code is as follows:
I am 2.14.1 version, everyone’s version may not Same, but the method is the same, then we will modify this sentence.
We can find the website in the URL in the above code to download:
Helping everyone, open it directly.
The downloaded gradle does not need to decompress.
Your project name / platforms / android / gradle
then The code we found above is modified:
Code The code is as follows: var district = process.env [‘cordova_android_gradle_distribution_url’] || ‘.. /Gradle-2.14.1-all.zip’;
Of course, there is no problem with other paths, but we need to cross-domain problems, so we need to turn on local services in the response path.
The code is as follows:
VAR DistributionURL = process.env [‘cordova_android_gradle_distribution_url’] || ‘http://127.0.0.1:8081/ Gradle-2.14.1-all.zip ‘;
is also available.
Optimizing the ionic2 program starts speed method seems to have a lot, and there is time to study a comprehensive point.
Thank you for reading the end, what is the problem welcome to exchange!
The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.