Cordova 实际上并未在 android 设备上安装应用程序 [英] Cordova does not actually install app on android device

查看:29
本文介绍了Cordova 实际上并未在 android 设备上安装应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 ubuntu 12.04 上设置了cordova 5.0.0 + android SDK API 22 (Android 5.1.1) 来开发应用程序.当我运行命令

I've setup cordova 5.0.0 + android SDK API 22 ( Android 5.1.1 ) on ubuntu 12.04 to develop an app. When I run the command

cordova run --device

它可以无误地构建 APK 并显示

it builds without errors the APK and shows

总时间:3.177秒构建了以下 apk:/var/www/tmp/test-app/platforms/android/build/outputs/apk/android-release-unsigned.apk使用apk:/var/www/tmp/test-app/platforms/android/build/outputs/apk/android-release-unsigned.apk在设备上安装应用程序...正在启动应用程序...发射成功

但实际上并没有将 APK 安装到设备上.

which however does NOT actually installs the APK to the device.

我尝试使用

adb install -r/var/www/tmp/test-app/platforms/android/build/outputs/apk/android-release-unsigned.apk

它奏效了.

我尝试从网络服务器下载 APK 并将其安装在本地设备上,它也能正常工作,所以我认为 APK 本身没问题,并且设备已被识别.

I have tried to download the APK from a web-server and install it locally on the device and it also worked, so I assume the APK itself is ok and the device is recognized.

当 APK 已经安装在设备上时,命令

When the APK is already installed on the device the command

cordova run --device

在控制台中产生相同的输出,并在设备上启动应用程序,但不安装它刚刚构建的较新版本.

produces the same output in the console plus it starts up the app on the device but does not install the newer version it just built.

我的 Android 设备是运行 Android 4.1.2 的 HTC Desire 500,而我的 Android SDK 使用的是 API 22 (Android 5.1.1),这可能是问题吗?

my android device is an HTC Desire 500 running Android 4.1.2, while my Android SDK is using API 22 ( Android 5.1.1 ) could that be the problem ?

最后一点:我在单独的机器上使用了带有 Android SDK API 19 的cordova 4.1.2 设置,它很好地构建了项目并且实际上安装了应用程序.

Final note: I have a setup on separate machine using cordova 4.1.2 setup with Android SDK API 19 and it builds the project well and actually DO install the app.

感谢您对可能导致这种奇怪行为的原因提出意见.

I would appreciate your input on what might cause this strange behavior.

干杯

推荐答案

似乎是 Cordova 5.0.0 中的一个错误,我遇到了同样的问题,proprit这个线程 为我解决了:

Seems to be a bug in Cordova 5.0.0, I had the same problem and the answer by proprit in this thread solved it for me:

在 Cordova 5.0.0 上,可以在 line 上找到用于安装 apk 的 adb 命令101 个文件平台\android\cordova\lib\device.js(以及第 311 行用于cordova仿真的平台\android\cordova\lib\emulator.js安卓):

On Cordova 5.0.0, adb commands to install the apk can be found at line 101 of file platforms\android\cordova\lib\device.js (and at line 311 of platforms\android\cordova\lib\emulator.js for cordova emulate android):

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

当前命令返回给我:错误:未知选项 -d"!如果你只需删除-d"选项,应用程序与cordova正常运行运行安卓.

Current command returns to me: "Error: unknown option -d"! If you simply delete the "-d" option, applications run normally with cordova run android.

这篇关于Cordova 实际上并未在 android 设备上安装应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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