问题
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..
回答1:
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.
回答2:
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.
回答3:
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
回答4:
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.
回答5:
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.
回答6:
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.
回答7:
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
- 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!”
回答8:
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
回答9:
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.
回答10:
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.
回答11:
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.
回答12:
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
回答13:
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:
- 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.
来源:https://stackoverflow.com/questions/37499118/no-target-device-found-android-studio-2-1-1