本文介绍了如何使用ionic-cli构建带有Crosswalk lite的Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Crosswalk( ionic browser add crosswalk; ionic build android )编译APK时,大小太大(〜20 MB)。我认为使用crosswalk精简会减少编译APK的大小。但我不知道如何使用crosswalk lite 。 / p>

我的问题是:
1.这会支持crosswalk lite吗?
2.使用crosswalk lite是否有任何hack(或临时解决方案)?



谢谢。

解决方案

这是实验性的,但它会工作,无法保证在您构建应用程序时没有错误,请阅读 ,可以看到最新的 10.39.234.1 我试过以后的版本,如12.xx,13.xx和14.xx,但徒劳,找不到任何回购的更高版本。


  • 导航到您的npm node-modules文件夹:Windows中的默认值为




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




    1. 在代码编辑器中找到第169行:

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



    这个函数负责下载你想要的crosswalk版本,它需要以下参数:

    我们将手动添加我们的lite版本,以便稍后下载。



    我们将暂时更改某些值,以便下载精简版,但稍后将其恢复为原始值:



    在第178行:



    更改



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



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

    p>


    1. 对象 crosswalkVersions ,将此对象添加到其中:

      {version:'10 .39.234.1',publish_date:'2015-03-06 03:06',canary:true}  



    您可以在CLI中测试该对象是否已成功运行此命令:

     离子浏览器列表

    您可以看到它列在可用的版本:


    1. 最后一步是通过CLI命令将您的crosswalk-lite项目下载到项目文件夹中:



      1.   ionic browser add [email protected]  pre> 



        这是你所做的一切。



        PS:



        我从未尝试过建立我的混合项目。


        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

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

        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 :

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

        That is all you are done.

        P.S:

        I have never tried ionic in building my hybrid projects.

        这篇关于如何使用ionic-cli构建带有Crosswalk lite的Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    10-20 13:44