Ionic2 Workaround when you pack Android?

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:

Copy code

code is as follows:

VAR DistributionURL = process.env [‘cordova_android_gradle_distribution_url’] || ‘ http \\: // ‘;

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’] || ‘.. /’;


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.

At this time, the address will change cost and add the port number corresponding to the service. Copy code

The code is as follows:

VAR DistributionURL = process.env [‘cordova_android_gradle_distribution_url’] || ‘ ‘;

is also available.

ionic2 package android App Open time long-term white screen simple solution: When using the ionic build android command, In the back plus -Prod parameters, use the ionic build android –prod command.
IDemo started 10 seconds before, and 4 seconds after Plus -Prod compiled.

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.

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment