Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 size of compiled APK. But I have no idea to hack ionic-cli to use crosswalk lite.

My question is: 1. Will this support crosswalk lite? 2. Is there any hack (or temporary solution) to use crosswalk lite?

Thanks.

like image 300
Pewh Gosh Avatar asked Apr 11 '15 01:04

Pewh Gosh


2 Answers

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 [email protected]

That is all you are done.

P.S:

I have never tried ionic in building my hybrid projects.

like image 139
ProllyGeek Avatar answered Oct 24 '22 18:10

ProllyGeek


Forget about Ionic-cli crosswalk-lite, it relies on cordova-plugin-crosswalk-webview, but cordova-plugin-crosswalk-webview does not support crosswalk-lite for now. If you wanna use crosswalk-lite, you will have to use cordova-android 3.0 way with CordovaLib provided with crosswalk-lite-cordova (https://download.01.org/crosswalk/releases/crosswalk-lite/android/canary/10.39.237.1/arm/crosswalk-cordova-10.39.237.1-arm.zip), because latest crosswalk-lite is 10.0. Good news is the team is working on rebasing lite to 14.0. Hopefully it comes out ASSP.

like image 32
poordeveloper Avatar answered Oct 24 '22 20:10

poordeveloper