How to build android with Crosswalk lite using ionic-cli?

后端 未结 3 2088
旧时难觅i
旧时难觅i 2021-02-13 07:18

When I compile APK using Crosswalk (ionic browser add crosswalk; ionic build android), the size is too big (~20 MB). I think using crosswalk lite will reduce the si

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-13 08:01

    This is experimentary , but it will work , cant guarantee there will be no bugs when you build your app though , please read this well before you proceed.

    Procedure : ( all steps are done from a machine running MS-Windows 8.1)

    1. First of all, I have searched for available crosswalk-lite everywhere to download the version from , it appears that there are only 3 available versions to download found here , and as you can see the latest is 10.39.234.1 i tried later versions like 12.xx , 13.xx , and 14.xx but in vain , could not find any repo for later versions.

    2. Navigate to your npm node-modules folder : default in windows is

    C:\Users\@YOUR_USER_NAME\AppData\Roaming\npm\node_modules

    find the ionic module folder , and then , and start editing browser.js file , file can be found inside:

    node_modules\ionic\lib\ionic\browser.js

    1. In your code editor find the line #169 :

    IonicTask.prototype.downloadCrosswalkWebview = function downloadCrosswalkWebview(architecture, version, releaseStatus) {
      .....
    
    }

    this function is responsible for downloading the crosswalk version you want , and it takes the following parameters :

    architecture , version and releaseStatus.

    We will be adding our lite version manually , so we can download it later.

    We will be changing some value temporarily for downloading lite version , but remmeber to turn it back to its original value later :

    in line#178 :

    change

     var downloadUrl = 'https://download.01.org/crosswalk/releases/crosswalk/android/' + releaseStatus + '/' +
        version + '/' + architecture + '/crosswalk-webview-' + version + '-' + architecture + '.zip';

    to be :

     var downloadUrl = 'https://download.01.org/crosswalk/releases/crosswalk-lite/android/' + releaseStatus + '/' +
        version + '/' + architecture + '/crosswalk-webview-' + version + '-' + architecture + '.zip';

    1. in line#39 there is an array of objects crosswalkVersions , add this object to it :

    {
      version: '10.39.234.1',
      publish_date: '2015-03-06 03:06',
      canary: true
    }

    You can test that object is added successfully running this command in your CLI :

    ionic browser list
    

    and as you can see it got listed in available versions: available xwalk versions

    1. Final step is to download your crosswalk-lite project into your project folder via CLI Command :

      ionic browser add crosswalk@10.39.234.1

    That is all you are done.

    P.S:

    I have never tried ionic in building my hybrid projects.

提交回复
热议问题