科尔多瓦“你好世界"应用程序不会显示 [英] Cordova "hello world" app won't display

查看:35
本文介绍了科尔多瓦“你好世界"应用程序不会显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Apache Cordova 的新手,我无法在 Android 上显示 Cordovahello world"应用程序.我说的是从 CLI 的cordova create"命令获得的默认应用程序.

I am new to Apache Cordova and I can't get the Cordova "hello world" application to display on Android. I'm talking about the default application obtained from the "cordova create" command from the CLI.

我阅读了文档并根据需要安装了所有东西(Node.js、npm、Cordova 5.0.0,我已经有了一个 Android SDK,所以我只需要更新 PATH).

I read the documentation and installed everything as required (Node.js, npm, Cordova 5.0.0, I already had an Android SDK so i just needed to update the PATH).

Cordova 告诉我构建成功.

Cordova tells me the build is a success.

然后它说应用程序已启动,但在设备/模拟器屏幕上唯一改变的是菜单被打开(如下图所示):http://i.stack.imgur.com/F7bI2.jpg

It then says the application is launched, but the only thing that changes on device/emulator screen is that a menu is opened (like on the following picture): http://i.stack.imgur.com/F7bI2.jpg

我在模拟器和真机上试过,结果是一样的.

I tried on an emulator and on a real device, results are the same.

我检查了 API 版本,它似乎足够高(4.0.3).我在 Windows 7 下,使用 Oracle JDK.我想可能是缺少插件并安装了cordova-plugin-device,但它并没有改变什么.

I checked the API version and it seems to be high enough (4.0.3). I'm under Windows 7, with an Oracle JDK. I thought maybe a plugin was missing and installed cordova-plugin-device, but it did change nothing.

这是一个错误还是我错过了什么?是否有某种方法可以获得错误报告(cordova run android"命令没有出现任何异常)?

Is this a bug or do I miss something? Is there some mean to get an error report (nothing unusual appears with the "cordova run android" command)?

推荐答案

我终于明白了.

问题似乎是 apk 没有正确安装.当我使用以下命令安装该应用程序时,该应用程序实际上能够运行(正如 jojo 在 cordova run android 执行正常.但 Android 4.1.2 不启动应用程序): adb install <path_to_apk>

Problem seemed to be that the apk was not properly installed. The application was in fact able to run when i installed it with the following command (as recommanded by jojo in cordova run android executes fine. But Android 4.1.2 doesn't start the app): adb install <path_to_apk>

所以我检查了 Cordova 代码以查看安装 apk 时会发生什么,并手动启动 Cordova 正在使用的命令:

So I checked Cordova code to see what happens when apk is installed, and manually launched the command Cordova is using:

adb -s ' +resolutionTarget.target + ' install -r -d "' + apk_path + '"

它返回:错误:未知选项 -d"!

It returns: "Error: unknown option -d"!

如果简单地删除-d"选项,应用程序可以正常运行cordova run android. 在 Cordova 5.0.0 上,您将在文件平台androidcordovalibdevice.js 的第 101 行(以及平台android 的第 311 行)找到这个命令cordovalibemulator.js for cordova emulate android).

我也不知道这个-d"选项是什么意思...这是 Cordova 错误吗?

I don't know what this "-d" option is meant too... Is this a Cordova bug?

正如 joris 在评论中所说:

As joris says in comment :

-d 应该直接在 adb 之后(如在 --device 中)而不是在安装之后.所以你可以把它移到那里而不是移除它.

The -d is supposed to come directly after adb (as in --device) instead of after install. So you can just move it there instead of removing it.

另外,这是 apache cordova 问题跟踪器上的未解决问题

这篇关于科尔多瓦“你好世界"应用程序不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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