简体   繁体   English

将Cordova应用程序导入人行横道

[英]Importing a cordova application to crosswalk

I am trying to use crosswalk runtime libraries with a cordova project and I am following all the steps given in the crosswalk documentation for migrating an application to crosswalk, but when I launch ADT and import the application and build it using the crosswalk libraries, I get an error in loadUrl(launchUrl); 我正在尝试将Crosswalk运行时库与Cordova项目一起使用,并且按照Crosswalk文档中给出的所有步骤将应用程序迁移到Crosswalk,但是当我启动ADT并导入应用程序并使用Crosswalk库进行构建时,我得到了loadUrl(launchUrl)中的错误; line of the java file(error: unable to resolve launchUrl as a variable). java文件的行(错误:无法将launchUrl解析为变量)。 the comment above it says it is set from the config.xml file line ( 它上面的注释说它是从config.xml文件行设置的(

Here is code with error: 这是有错误的代码:

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); 公共无效onCreate(捆绑保存的InstanceState){super.onCreate(savedInstanceState); // Set by in config.xml loadUrl(launchUrl); //在config.xml中设置by loadUrl(launchUrl); } }

Replace launchUrl with Config.getStartUrl() Config.getStartUrl()替换launchUrl

The getStartUrl() call was replaced with launchUrl in July [1]. 7月[1]中,将getStartUrl()调用替换为launchUrl crosswalk must be using an older version of cordova. 人行横道必须使用旧版本的cordova。

[1] https://github.com/apache/cordova-android/commit/705991e5b037743e632934b3c6ee98976e18d3f8 [1] https://github.com/apache/cordova-android/commit/705991e5b037743e632934b3c6ee98976e18d3f8

Crosswalk 7.x and 8.x won't work with Cordova 3.6. Crosswalk 7.x和8.x不适用于Cordova 3.6。 Replacing launchUrl with Config.getStartUrl() can get rid of compile errors, but the app won't run. 用Config.getStartUrl()替换launchUrl可以摆脱编译错误,但该应用程序将无法运行。 In the case of my app, it gave me a blank screen. 就我的应用而言,它给了我一个空白的屏幕。

The proper solution I found is to stay with Cordova 3.5, install it as the following: 我发现正确的解决方案是继续使用Cordova 3.5,按如下所示安装它:

$ npm install -g cordova@3.5.0-0.2.7

After downgrading to 3.5.x, re-generate the android app: 降级到3.5.x后,重新生成android应用:

$ cordova platform rm android
$ cordova platform add android

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM