[英]cordova run (in real) android device using command line?
According to thedocumentation根据文档
We can run our android project on an emulator by:我们可以通过以下方式在模拟器上运行我们的 android 项目:
cordova run android
or cordova run android
或
cordova emulate android
But how to run a project on a real android device?但是如何在真正的安卓设备上运行一个项目呢?
thanks a lot多谢
-EDIT- -编辑-
adb devices
list none.. adb devices
没有列出..
You can force the run on device like this您可以像这样强制在设备上运行
cordova run android --device
If you get an error message like "No devices found" then make sure that you have developer mode and USB Debugging enabled on the device and also run adb kill-server
and then adb devices
should list your device and cordova run android --device
should work如果您收到“未找到设备”之类的错误消息,请确保您在设备上启用了开发人员模式和 USB 调试,并运行adb kill-server
,然后adb devices
应列出您的设备, cordova run android --device
应工作
For iOS you can run from macOS对于 iOS,您可以从 macOS 运行
cordova run ios --device
If it doesn't work, make sure you have ios-sim
and ios-deploy
installed and that you have your development certificate and a wildcard provisioning profile on your machine.如果它不起作用,请确保您安装了ios-sim
和ios-deploy
,并且您的机器上有您的开发证书和通配符配置文件。 You can open the .xcworkspace
file on /platforms/ios/ and Xcode will help you to create the certificates and provisioning profiles when you try to run the app.您可以在 /platforms/ios/ 上打开.xcworkspace
文件,当您尝试运行应用程序时,Xcode 将帮助您创建证书和配置文件。
If a real device is connected to your pc and it is recognized as well, you ca just use如果一个真实的设备连接到你的电脑并且它也被识别,你可以使用cordova run android
and the app will start on your device.该应用程序将在您的设备上启动。 It worked for me.它对我有用。
you can do你可以做
cordova run android
That did not work for me for some reason.由于某种原因,这对我不起作用。 so what I did was copy the apk to the device.所以我所做的是将 apk 复制到设备上。 install it.安装它。 and use chrome's remote debugging .并使用 chrome 的远程调试。 by goint to chrome://inspect
in chrome.通过转到chrome://inspect
in chrome。
For some reason, running it up from the cordova directory speeds up the time it takes to run the app on the device.出于某种原因,从cordova 目录运行它会加快在设备上运行应用程序所需的时间。
If you're on Ubuntu:如果您使用的是 Ubuntu:
$ cd /path/to/project/platform/android/cordova/
$ node run --device
For Windows:对于 Windows:
> cd /path/to/project/platform/android/cordova/
> run --device
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.