65

i'm using android studio 2.1.1 in ubuntu 14.04.Now my question is,i want to run the program through my phone without emulator. so i chose the target as usb device but whenever i run this,below mentioned error is rasing.

Error running app : No target device found.

i checked my device by using adb devices command in terminal. adithya@adithya-Lenovo-B460e:~$ adb devices List of devices attached 59V8I7HEJJWGGMK7 device

i also tried with selecting of MTP & PTP.but nothing worked out. kindly anyone help me to solve this problem..

Adithya
  • 813
  • 1
  • 7
  • 10
  • 1
    please check have you set On to developers options in your mobile. I think this is the problem. – Mohammed Sameer Ahmad May 28 '16 at 13:25
  • Have you tried Settings->Developer Options->Turn on USB Debugging? (To access dev options go to about device & tap build number repeatedly) – Script Kitty May 29 '16 at 03:18
  • yes it is in debugging mode but not working @MohammedSameerAhmad – Adithya May 30 '16 at 06:16
  • Yes tried yours answer but now working pls give me some more solutions @ScriptKitty – Adithya May 30 '16 at 06:17
  • In android studio to the left of the run button click the dropdown and hit edit configurations. Choose option that says something like USB – Script Kitty May 30 '16 at 15:00
  • in my case that was because of Platform-Tools. check my solution here : https://stackoverflow.com/questions/40022679/android-studio-no-target-device-found/71219257#:~:text=In%20my%20case%20that%20was%20because%20of%20Platform%2DTools.%20I%20updated%20that%20and%20solved.%20path%3A%20File%20%7C%20Settings%20%7C%20Appearance%20%26%20Behavior%20%7C%20System%20Settings%20%7C%20Android%20SDK%20%2D%3E%20Android%20SDK%20Platform%2DTools – Sadegh J Feb 22 '22 at 10:05

15 Answers15

161

I already had this problem before.

Choose "Run" then "Edit Configurations". In the "General" tab, check the "Deployment Target Options" section.

In my case, the target was already set to "USB Device" and the checkbox "Use same device for future launches" was checked.

I had to change the target to "Show Device Chooser Dialog" and I unchecked the check box. Then my device appeared in the list.

If your device still doesn't appear, then you have to enable USB-Debugging in the smartphone settings again.

Black
  • 18,150
  • 39
  • 158
  • 271
Jeremie
  • 3,666
  • 2
  • 18
  • 10
15

go to "Run>edit configuration>" and select "Open select deployment target dialog" from deployment target option then run your app it will show you a dialog box you can choose your target device from there, enjoy it.

Basant
  • 741
  • 7
  • 16
10

trick that works for me when target device not found:

  • click the "attach debugger to android process" button. (that will enable adb integration for you)

  • click the run button

dvrm
  • 3,749
  • 4
  • 34
  • 43
3

I have used a different USB cable and it started working. This is weird because the USB cable (which was not detected in android studio) was charging the phone. This made me feel like there was a problem on my Mac.

However changing the cable worked for me. Just check this option as well if you got stuck with this problem.

Sheshank Kodam
  • 515
  • 5
  • 17
3

On the phone

  1. Have you enabled Developer Mode?

  2. Have you enabled USB debugging within the Developer Tools menu in settings (this menu doesn't appear unless you've enabled Developer Mode)

  3. Do you have a good and securely connected USB cable?

In Android Studio

  1. In Edit Run/Debug Configurations, do you have "Target: USB Device"?

  2. It may help to download the latest version of the USB driver for that particular phone.

It's also helpful to know whether your phone appears as a recognised device at the operating system level. And when in doubt, reboot everything you can think of.

Tim Cooper
  • 10,023
  • 5
  • 61
  • 77
2

Note: I had problem on Windows 7 but it might help you as well..

I had problem with android studio detecting my phone(Acer Liquid Zest 4G), tried restarting android studio, switching back and forth between PTP and MTP, OS was able to detect device normally.

So what I did was, in Developer Options i enabled USB debugging, USB connection is in PTP mode, then from phone manufacturer's site (you can find site for your phone here: https://developer.android.com/studio/run/oem-usb.html), I downloaded USB driver for my phone model, installed driver and android studio was able to detect my phone(there was no need for restart).

I will repeat again, you must have USB Debugging enabled in Developer Options, otherwise it won't work. Hope it helps.

WhiteSnake
  • 21
  • 2
1
  1. Set up a device for development https://developer.android.com/studio/run/device.html#setting-up

  2. Enable developer options and debugging https://developer.android.com/studio/debug/dev-options.html#enable

Optional

  1. How to enable Developer options and USB debugging
    • Open Settings menu on Home screen.
    • Scroll to About Tablet and tap it.
    • Click on Build number for seven times until a pop-up message says “You are now a developer!”
NoWar
  • 36,338
  • 80
  • 323
  • 498
1

try with

sudo adb kill-server
sudo devices

or

echo $ANDROID_HOME
sudo $ANDROID_HOME/platform-tools/adb kill-server 
sudo $ANDROID_HOME/platform-tools/adb devices
Leonardo Pineda
  • 990
  • 8
  • 10
0

After i changed my target to usb. i had to create the file /etc/udev/rules.d/51-android.rules with vendor details .Click for Solution

Adithya
  • 813
  • 1
  • 7
  • 10
0

If you are using 32-bit ubuntu (my case) then it is most likely that Android Studio has downloaded 64-bit version of adb and fastboot inside your sdk/platform-tools folder. I think you already have installed adb (and fastboot). If you haven't then run these commands in terminal:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot

This will install 32-bit version of adb and fastboot. Now just replace the 64-bit adb and fastboot executable files in sdk/platform-tools with the installed 32-bit versions:

cp /usr/bin/adb <path-to-your-adt-sdk-package>/sdk/platform-tools/adb
cp /usr/bin/fastboot <path-to-your-adt-sdk-package>/sdk/platformtools/fastboot

Now your android studio should be able to run your App in your device.

utsav_deep
  • 621
  • 6
  • 23
0

I had the same thing on Windows 7 where I had the device properly set and the driver installed, and I was routinely running on the device. Then suddenly I started getting this error every time. I opened the Edit Configurations dialog as described above, switched to an emulator, tried one run, then went to the same dialog and changed back to USB. Then if worked again.

Jonathan Starr
  • 236
  • 4
  • 15
0

I had this problem after upgrading from Android Studio 2.3 to 3.0. As simple as it sounds, I actually just restarted my phone to fix it.

My guess is that the adb server on the phone somehow cached something from the previous installation of android studio, maybe a connection object or something, and by restarting the adb server it resolved the issue.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Josh Chappelle
  • 1,558
  • 2
  • 15
  • 37
0
  1. If suppose the android device is not getting connected by android studio then download "PDANet+"(for all android devices).

  2. Or also you can do these following steps:

    • Go to Run tab on toolbar of android studio.
    • Then click on edit configuration
    • In General tab there will "Deployment Target Option" click on "Target" and choose "Open select deployment target dialog" and uncheck the checkbox from below.
    • And at last click OK. Finish.
piet.t
  • 11,718
  • 21
  • 43
  • 52
Rakesh Jha
  • 279
  • 2
  • 7
0

This happened to me on android studio version 4 after doing an update to the IDE. The "invalidate caches and restart" option fixed it.

0

On the phone, after enabling "Developer Mode", the following settings will appear: Developer Options -> Default USB Configuration. It will let you choose how to use USB device e. g.:

  • File transfer
  • USB tethering
  • MIDI
  • PTP etc.

Try all of them. I got a chance of debugging working with one option and not working with another.

Liker777
  • 2,156
  • 4
  • 18
  • 25