Reputation: 833
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..
Upvotes: 67
Views: 153948
Reputation: 602
For me the issue was the running adb service/server was frozen (it tend to do that every now and often). The solution was to go to "Activity Monitor" (I'm on a Mac) => Find the "adb" process and force quit it. Then, running the app from Android Studio worked again.
Alternative terminal solution: The "adb" process can also be found and killed from terminal. List processes:
ps -ax
Find the adb process id, e.g.
17582 ?? 0:01.26 adb -L tcp:5037 fork-server server --reply-fd 4
Kill it:
kill 17582
Upvotes: 0
Reputation: 2267
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.:
Try all of them. I got a chance of debugging working with one option and not working with another.
Upvotes: 0
Reputation: 1588
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.
Upvotes: 0
Reputation: 110
This happened to me on android studio version 4 after doing an update to the IDE. The "invalidate caches and restart" option fixed it.
Upvotes: 0
Reputation: 3773
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.
Upvotes: 160
Reputation: 379
If suppose the android device is not getting connected by android studio then download "PDANet+"(for all android devices).
Or also you can do these following steps:
Upvotes: 0
Reputation: 1030
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
Upvotes: 1
Reputation: 10468
On the phone
Have you enabled Developer Mode?
Have you enabled USB debugging within the Developer Tools menu in settings (this menu doesn't appear unless you've enabled Developer Mode)
Do you have a good and securely connected USB cable?
In Android Studio
In Edit Run/Debug Configurations, do you have "Target: USB Device"?
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.
Upvotes: 3
Reputation: 37633
Set up a device for development https://developer.android.com/studio/run/device.html#setting-up
Enable developer options and debugging https://developer.android.com/studio/debug/dev-options.html#enable
Optional
Upvotes: 1
Reputation: 515
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.
Upvotes: 3
Reputation: 254
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.
Upvotes: 0
Reputation: 781
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.
Upvotes: 15
Reputation: 631
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.
Upvotes: 0
Reputation: 21
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.
Upvotes: 2
Reputation: 3759
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
Upvotes: 10
Reputation: 833
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
Upvotes: 0