14

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.

Pewh Gosh
  • 1,031
  • 1
  • 11
  • 29
  • I guess you would have to fork ionic-cli and change the browser configuration to implement Crosswalk Lite. This is how Crosswalk is implemented: https://github.com/driftyco/ionic-cli/blob/3e3438366a7b65b013e2eeeaab5f44a55fd3ba53/lib/ionic/browser.js#L109 – kevinpelgrims May 12 '15 at 20:38
  • try this http://stackoverflow.com/a/42314666/3966458 – Saahithyan Vigneswaran Feb 18 '17 at 11:43

3 Answers3

9

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.

ProllyGeek
  • 15,517
  • 9
  • 53
  • 72
  • Thanks for your comprehensive explanation :) By the way, what ionic version you used? I'd installed 1.4.1 & I didn't see line #169 on step 3. – Pewh Gosh May 15 '15 at 03:39
  • @PewhGosh i installed latest via the npm , just use "npm install -g ionic" , anyway current version is"version": "1.3.22", – ProllyGeek May 15 '15 at 03:52
  • @PewhGosh you dont have to follow my line numbers , just search for this : "IonicTask.prototype.downloadCrosswalkWebview" in the specified file. – ProllyGeek May 15 '15 at 03:53
  • Thanks @ProllyGeek. I've done `npm install -g ionic` too and the latest version shows 1.4.1. Both of 1.3.x and 1.4.1 version use different code on `node_modules\ionic\lib\ionic\browser.js`, so I think your method above only affect on 1.3.x. I do `npm install -g ionic@1.3.22`, follow your method above, and it success to build. Unfortunately, it crashes when I open with emulator and android devices. – Pewh Gosh May 15 '15 at 07:22
  • And now ionic@1.4.1 has support crosswalk lite (ionic browser add crosswalk-lite). It success to build, but it also crash too. I guess the issue is some of cordova plugins doesn't support crosswalk lite. BTW when I compile with crosswalk, it doesn't crash. I'll create another post about that later. Anyway, thanks for your answer :) – Pewh Gosh May 15 '15 at 07:28
  • @PewhGosh installing ionic without specifying version will install latest stable release , and concerning the crash issue , you should install any logger and check out why your app crashes , glad i could help. – ProllyGeek May 15 '15 at 10:50
  • @PewhGosh btw what is your cordova version, and what plugins are you using, one incompatible plugin can destroy your app. – ProllyGeek May 15 '15 at 10:53
  • sorry for very long waiting. I think this issue is on crosswalk-lite, not plugin. I just started using ionic starter, add crosswalk-lite, and it show same error too. Here's my post http://stackoverflow.com/questions/30452079/ionic-starter-cant-run-on-crosswalk-lite-unable-to-start-activity-componentinf – Pewh Gosh May 26 '15 at 07:25
2

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.

poordeveloper
  • 2,272
  • 1
  • 23
  • 36
0

Ionic-cli now has an option for lite:

ionic browser list

ionic browser add crosswalk-lite

although, you may want to see this post

Community
  • 1
  • 1
Fernando Fabreti
  • 4,277
  • 3
  • 32
  • 33