如何构建Android与人行横道精简版采用离子-CLI? [英] How to build android with Crosswalk lite using ionic-cli?

查看:179
本文介绍了如何构建Android与人行横道精简版采用离子-CLI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用人行横道编译APK(离子浏览器插件人行横道;离子构建Android ),尺寸过大(约20 MB)。我想用人行横道精简版会降低编译APK的大小。但我不知道破解<一个href="https://github.com/crosswalk-project/crosswalk-cordova-android/tree/crosswalk-lite">ionic-cli使用人行横道精简版。

我的问题是: 1.将这种支持人行横道精简版? 2.是否有任何黑客(或临时解决方案)使用人行横道精简版?

感谢。

解决方案

这是experimentary,但它会工作,着保证不会再有,当你建立你的应用程序,虽然,请阅读错误的 <一个href="https://github.com/crosswalk-project/crosswalk-website/wiki/Crosswalk-Project-Lite">this好,然后再继续。

步骤:(所有步骤都是由一台运行微软Windows 8.1一样)

  1. 首先,我已经寻找可用的人行横道,精简版处处从下载的版本,似乎只有3个可用的版本下载中的这里 ,然后你可以看到最新的是 10.39.234.1 我想以后的版本一样12.xx,13.xx和14.xx但不成功,找不到任何回购更高版本。

  2. 浏览到您的NPM节点模块文件夹:默认情况下,Windows是

  

C:\ Users \用户@YOUR_USER_NAME \应用程序数据\漫游\故宫\ node_modules

找到离子模块文件夹,然后,开始编辑browser.js文件,文件里面都可以找到:

  

node_modules \离子\ lib目录\离子\ browser.js

<醇开始=3>
  • 在code编辑器,找到该行#169:
  • IonicTask.prototype.downloadCrosswalkWebview =功能downloadCrosswalkWebview(建筑,版本,releaseStatus){   ..... }

    这个功能是负责下载你想要的人行横道版本,它采用下列参数:

      

    结构,版本和releaseStatus。

    我们将手动添加我们的精简版的版本,所以我们可以稍后再下载。

    我们会暂时改变一些价值下载精简版的版本,但remmeber把它恢复到原来的值之后:

    在行#178:

    变更

    VAR downloadUrl ='https://download.01.org/crosswalk/releases /人行横道/安卓/+ releaseStatus +/+     版+/+建筑+'/人行横道,webview-'+版本+' - '+建筑+.ZIP;

    是:

    VAR downloadUrl ='https://download.01.org/crosswalk/releases /人行横道-精简版/安卓/+ releaseStatus +/+     版+/+建筑+'/人行横道,webview-'+版本+' - '+建筑+.ZIP;

    <醇开始=4>
  • 在线路#39有对象的数组 crosswalkVersions ,这个对象添加到它:
  • {   版本:'10 .39.234.1,   出版日期:2015年3月6日03:06,   金丝雀:真 }

    您可以测试对象添加成功在CLI上运行以下命令:

     离子浏览器列表
     

    和,你可以看到它得到了列在可用的版本:

  • 在最后的步骤是通过CLI命令下载您的人行横道,精简版的项目到项目文件夹:
  • 离子浏览器插件crosswalk@10.39.234.1

    这是所有你做。

    P.S:

    我从来没有尝试过的离子在建设我的混合动力车的项目,但作为一个建议,给出的 英特尔XDK 一试。

    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.

    解决方案

    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:

    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 , but as an advice , give intel XDK a try.

    这篇关于如何构建Android与人行横道精简版采用离子-CLI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆