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 dev
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.
I hope this helps someone.
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
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
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.
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:
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