Reputation:
I am trying to run an app that I made in phonegap on my device, connected with USB.
-> phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[phonegap] successfully compiled Android app
[phonegap] trying to install app onto device
[phonegap] no device was found
-> adb devices
List of devices attached
SH25PW103163 device
I just ran a native Android app in eclipse on this device, I have USB Debugging activated.
What can be wrong?
Upvotes: 40
Views: 84256
Reputation: 8410
What worked for me was changing the device from a media device to camera in the USB settings.
Upvotes: 14
Reputation:
If you have only one adb-capable device, use this command:
phonegap run android --device
If you have more than one you will need to specify the device ID this way:
phonegap run android --device=<device-id>
Example:
phonegap run android --device=SH25PW103163
phonegap run android --target=SH25PW103163
If you want to know the code of a device execute this in the console (shell, terminal):
adb devices
Upvotes: 85
Reputation: 637
Finally I solved this problem with two ways and I just want to share my experience with you.
cordova run android --device
Upvotes: 0
Reputation: 1
On LG G4 (on Windows OS) you need to do the following:
cordova run android --device
Upvotes: 0
Reputation: 593
Please follow below steps to run cordova application on android device.
Remove the default USB driver installed for your device. As shown below remove Samsung_Android device.
Disconnect USB cable from android device.
Upvotes: 0
Reputation: 384
I´ve an LG G4, and i´m using Visual Studio Tools for Apache Cordova (TACO).
When trying to debug on device i was receiving the message: Unable to deploy to Android device, no attached device was found. If you recently attached a device, you may need to wait a few seconds before it is recognized.
And what worked for me was changing the device from the media transfer protocol (MTP) to photo transfer protocol (PTP), in the USB settings. Phone Screenshot
Upvotes: 1
Reputation: 186
If you have only one device attached, phonegap run android --device
is enough.
Upvotes: 9
Reputation: 169
The methods mentioned in the other answers didn't work for me. What worked for me was googling Samsung Galaxy Tab USB driver and downloading and running it. The application then got my device recognized when I did adb devices. Since I was using a Samsung Galaxy, I used this link to download the usb driver from the OFFICIAL Samsung site. You would want to google your own respective android model usb driver
http://www.samsung.com/us/support/owners/product/SCH-I925EAAVZW
After downloading it, I ran the application to install my usb driver and then did adb devices. Make sure your Google USB driver from the Android SDK is downloaded and that your sdk is up to date as well. Also, make sure that your USB debugging mode is enable by going to Settings -> Developer Options -> then checking USB debugging. After all this, your device in the Device Manager should not have a yellow exclamation point next to it. When you run adb devices your device should show up. Hope this helps people. I literally spent hours trying to figure this out.
Upvotes: 0
Reputation: 1266
I was having this same problem on an LG Optimus phone; adb reported that the device was there, but cordova run android --device
failed with "Failed to deploy to device; no devices found". Turns out that of the four connection modes available on the phone:
The only one that works is Internet connection -> Modem
Hope this saves someone some hair-tearing. :)
Upvotes: 0
Reputation: 2682
Just wanted to share my experience, I wasn't able to launch my cordova app on device. What solved my problem is to upload apk manually:
adb install -r platforms\android\build\outputs\apk\android-debug.apk
Upvotes: 3
Reputation: 773
On windows I needed to install device drivers for my phone (Moto G) from the Motorola site. Updating the SDK, Google USB drivers etc didn't make any difference; every time I did adb devices
there was nothing shown.
After I installed the Motorola drivers locally the device showed up.
Upvotes: 0
Reputation: 2548
I had similar problem. I cloned code from git and the phonegapp did not install app in my device (LG Nexus 4). But I had another app installed in my phone with the same name and ID of the app that I was trying to install.
Removing the old app from my phone solved this problem to me.
Upvotes: 15
Reputation: 2812
I had this same issue but for a different reason. Here's how I solved it...
Working on the same project from two machines could cause a conflict when installing the app from the second machine. Either uninstall the app from the phone and fresh install or change the widget ID. Hope this helps someone, the PhoneGap CLI doesn't explicitly give an error telling this.
Upvotes: 8