cordova run (in real) android device using command line?

ぃ、小莉子 提交于 2019-12-10 00:38:15

问题


According to the documentation

We can run our android project on an emulator by:

cordova run android or

cordova emulate android

But how to run a project on a real android device?

thanks a lot

-EDIT-

adb devices list none..


回答1:


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

For iOS you can run from 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. 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.




回答2:


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.




回答3:


you can do

cordova run android

as documented here.

That did not work for me for some reason. so what I did was copy the apk to the device. install it. and use chrome's remote debugging . by goint to chrome://inspect in chrome.



来源:https://stackoverflow.com/questions/28851828/cordova-run-in-real-android-device-using-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!