user89862
user89862

Reputation:

Running phonegap on device - no device found

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

Answers (14)

filype
filype

Reputation: 8410

What worked for me was changing the device from a media device to camera in the USB settings.

USB computer connection (Camera).png

Upvotes: 14

user89862
user89862

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

Doston
Doston

Reputation: 637

Finally I solved this problem with two ways and I just want to share my experience with you.

  1. I have done all above mentioned and also other ways but it didnt work. So I have deleted all my Virtual Device from Android Studio, then :

cordova run android --device

  1. I have opened Cordova project into Android Studio then I was able to see connected device, so it worked well

Upvotes: 0

Florian Schimandl
Florian Schimandl

Reputation: 1

On LG G4 (on Windows OS) you need to do the following:

  1. Install LG USB drivers from http://www.lg.com/uk/support/support-mobile/lg-LGH815
  2. Activate Developer mode (7 clicks stuff)
  3. Activate USB debugging for current workstation computer (in developer options)
  4. Connect device (adb drivers will be installed then)
  5. Run cordova run android --device

Upvotes: 0

Mayank Nimje
Mayank Nimje

Reputation: 593

Please follow below steps to run cordova application on android device.

  1. Go to control panel in windows and open device manager.
  2. Remove the default USB driver installed for your device. As shown below remove Samsung_Android device. enter image description here

  3. Disconnect USB cable from android device.

  4. Again connect the USB cable and select USB drivers installation from Windows online (search online).

enter image description here

Upvotes: 0

Gabriel
Gabriel

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

Teoni Valois
Teoni Valois

Reputation: 186

If you have only one device attached, phonegap run android --device is enough.

Upvotes: 9

dtong
dtong

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

Mike Dailor
Mike Dailor

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:

  • Charge phone
  • Media sync (PTP)
  • Internet connection
  • Camera (PTP)

The only one that works is Internet connection -> Modem

Hope this saves someone some hair-tearing. :)

Upvotes: 0

InGeek
InGeek

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

Nedudi
Nedudi

Reputation: 5989

Just use

cordova run android --device

Upvotes: 5

Darren Beale
Darren Beale

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

Fabio Montefuscolo
Fabio Montefuscolo

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

SacWebDeveloper
SacWebDeveloper

Reputation: 2812

I had this same issue but for a different reason. Here's how I solved it...

  1. Installed Google USB Driver
  2. Installed Samsung USB Driver
  3. Updated my Android SDK Platform-tools (Android SDK Manager)
  4. Edited Widget ID in config.xml to something different. <-- Finally 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

Related Questions