Android Studio doesn’t see device
The AVD Manager in Android Studio doesn’t show my device but adb devices does show it. Am I missing something obvious here?
65 Answers 65
To change what your application defaults to when you click run or debug in Android Studio, follow these steps:
1. go to Run
2. Click on Edit Configurations
3. Select the project
4. find the Target Device section under the General tab on the Android Application page.
That seems to be where you toggle what the project builds to. If you’re importing a project it actually defaults to Emulator, not sure why. You can also select «Open Select Deployment Target Dialog» to list both connected as well as emulated devices.
I recently had trouble with this, and regardless of what I did(restart adb, edit adb_usb.ini, restart computer+device+swap usb port, reinstall studio etc. etc.) I just couldnt get it to work, and could not even detect my device using ‘adb devices’. Finally after about 2 hours of googling and testing, someone suggested switching to PTP instead of MTP on my device. When I did this I got a popup on my device asking me to allow my mac access and suddenly everything worked(had to restart studio for it to show up there as well though).
I might be bumping this thread now, but it is the first result on google search, and I had a lot of trouble finding an answer for this problem, so I thought this should be added as a solution.
On your device:
Go to settings/ developer settings/ allow USB debug mode
If ‘allow USB debug mode’ option is disabled. Then you might have the device currently connected to your PC. Disconnect the device and the option should now be available
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
If it still doesn’t help, you can google it with this expression:
How to enable developer options on YOUR_PHONE_TYPE
Some cables can not been used for developer mode or transfer file. A solution would be change your cable and don’t waste time.
I had to killall adb because somehow, Android Studio managed to crash and did not want to communicate with adb anymore. Thus, my device did not show up.
So quitting Android Studio, terminating all adb instances in Terminal and starting Android Studio again (should ask if it should enable debugging then) worked.
It works for me by following steps below:-
If you using Windows, the device won’t show up because of driver issue.
Go to device manager (just search it using Start) and look for any devices showing an error. Many androids will show as an unknown USB device and comes with exclamation mark. Select that device and try to update the drivers for it. for update part follow the link:universal adb
But before that, you have to update your sdk manager and make sure Google USB Driver package is installed.
When done, the driver files are downloaded into the \extras\google\usb_driver\ directory. Hints: Search «android_winusb.inf» under Windows Start and Open File Location to get the directory mentioned.
Open up your device manager, navigate to your android device, right click on it and select Update Driver Software then select Browse driver software. Follow the file location path previously to install Google USB Driver.
Restart Android Studio and Developer Options in your android device and reconnect USB.
android studio doesn’t detect my device on my ubuntu laptop
I am trying to run an app from Android Studio on my Ubuntu laptop.
I have enabled USB debugging, but it is still not working.
When I press run in Android Studio, it does not detect my device (LG G3 Lollipop).
I could not find any help 🙁
9 Answers 9
Open terminal and do following:
Do lsusb command to check your device is indeed connected.
Do adb devices to check if your device is connected then it is detected as in adb mode.
2.a. if the above command is not found, do sudo apt-get install android-tools-adb and then check if it is listed.
Secondly, post results of step 1 and 2 with your question to help us in finding a correct solution.
- Make sure adb mode in enabled.
- Make sure you have opted for Allow option when prompted for in your device upon connecting to your ubuntu system.
- This one is from some past LG users, Try connecting your device in PTP mode rather than MTP mode, it surprisingly works.
- If it atill doesn’t work, (most likely your case), try googling. I landed upon this page by pressing I’M FEELING LUCKY, you should try to feel lucky once in a while. Source for step number 3 and 4
follow the steps as mentioned upon page:
- Create a file: /etc/udev/rules.d/70-android.rules .
- Write: SUBSYSTEM==»usb», ATTR
==»1004″, MODE=»0666″ to the file. - Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
- Reboot the system and restart udev.
As a second step of troubleshooting (make sure you again repeated troubleshooting from step1 in case you failed at this step)
Connect Android device to Android studio in Ubuntu
I guess device 005 is my phone. I get to transfer files using usb. Android studio still can’t detect my phone. I have no idea what to place on 51-android.rules as my device is Xiaomi Redmi Note 5 pro.
1 Answer 1
I don’t think editing 51-android.rules file is important. Before connecting your device into Android Studio you need to enable USB Debugging. And if you’re a Redmi user, you need to enable an extra setting called Install via USB in Developer Options. (I am a Redmi user too :))
To enable USB debugging goto Settings — About Phone — and tap 7 times continuously on MIUI version. Now you get a message «You’re now developer». If you’ve already enabled it, you’ll get «No need you already developer».
After that goto Settings — Additional Settings — Developer Options — and enable USB debugging also Install via USB
But, you may face a weird problem like «The device is temporarily restricted» while enabling Install via USB. To resolve this problem please check this StackOverflow thread: Install app via usb: The device is temporarily restricted
Now you’re good to connect your device with Android Studio.
Android Studio: установка на Linux и работа с Android Virtual Devices
Есть у нас UI-автотесты, которые немного поломались — надо пофиксить, заодно появился повод вообще с ними разобраться.
Для тестирования используется Android Virtual Device и эмулятор из Android Studio. В этом посте — установка студии и создание такого устройства, в следующем — запуск Appium тестов на нём.
Установка и запуск выполняются на Arch Linux, но процесс не специфичен для этой системы.
Установка Android Studio
Кроме самой студии потребуется эмулятор девайсов — Android Emulator , он будет установлен во время первого запуска Студии:
Либо можно установить из AUR — android-emulator .
sdkmanager
Для управления пакетами в Android Studio используется sdkmanager .
Получаем список установленных пакетов:
AVD — Android Virtual Device, для управления используем avdmanager .
Получаем список имеющихся вирутальных устройств — пока тут пусто:
Мне надо создать устройство — телефон Nexus и с API v26 .
Находим девайс в списке поддерживаемых:
Находим пакет с нужной версией API с помощью sdkmanager (тут немного поломалось форматирование, в консоли оно выглядит приятнее):
Вот он — system-images;android-26;google_apis_playstore;x86 .
Run apps on a hardware device
When building an Android app, it’s important that you always test your app on a real device before releasing it to users. This page describes how to set up your development environment and Android device for testing and debugging over an Android Debug Bridge (ADB) connection.
Note: Use the Android emulator to test your app on different versions of the Android platform and different screen sizes. Also consider using Firebase Test Lab to run your app on a wide variety of real devices hosted in a cloud-based infrastructure.
Set up a device for development
Before you can start debugging on your device, there are a few things you must do:
On the device, open the Settings app, select Developer options, and then enable USB debugging.
Set up your system to detect your device.
- Chrome OS: No additional configuration required.
- macOS: No additional configuration required.
Ubuntu Linux: There are two things that need to be set up correctly: each user that wants to use adb needs to be in the plugdev group, and the system needs to have udev rules installed that cover the device.
plugdev group: If you see an error message that says you’re not in the plugdev group, you’ll need to add yourself to the plugdev group:
Note that groups only get updated on login, so you’ll need to log out for this change to take effect. When you log back in, you can use id to check that you’re now in the plugdev group.
udev rules: The android-sdk-platform-tools-common package contains a community-maintained default set of udev rules for Android devices. To install:
Windows: Install a USB driver for ADB. For an installation guide and links to OEM drivers, see the Install OEM USB drivers document.
Connect to your device
When you are set up and plugged in over USB, you can click Run in Android Studio to build and run your app on the device.
You can also use adb to issue commands, as follows:
- Verify that your device is connected by running the adb devices command from your android_sdk /platform-tools/ directory. If connected, you’ll see the device listed.
- Issue any adb command with the -d flag to target your device.
Troubleshoot device connection with the Connection Assistant
The Connection Assistant provides step-by-step instructions to help you set up and use a device over the ADB connection.
To start the assistant, choose Tools > Connection Assistant.
The Connection Assistant provides instructions, in-context controls, and a list of connected devices in a series of pages in the Assistant panel. Use the Next and Previous buttons at the bottom of the Assistant panel to work through the pages as needed:
- Connect your device over USB: The Connection Assistant begins by prompting you to connect your device over USB, and it provides a Rescan USB devices button with which you can start a new scan for connected devices.
- Enable USB debugging: The Connection Assistant then tells you how to enable USB debugging in the on-device developer options.
- Restart the ADB server: Finally, if you still don’t see your device on the list of available devices, you can use the Restart ADB server button on the last page of the Connection Assistant. Restarting the ADB server also causes ADB to scan for devices again. If you still don’t see your device on the list of available devices, try the troubleshooting steps in the next section of this page.
Resolve USB connection issues
If the Connection Assistant is not detecting your device over USB, you can try the following troubleshooting steps to resolve the issue:
Check that Android Studio can connect to the Android Emulator
To check if the issue is being caused by a connection problem between Android Studio and the Android Emulator, follow these steps:
- Open the AVD Manager.
- Create a new AVD if you don’t already have one.
- Run the emulator using your AVD.
- Do one of the following:
- If Android Studio can’t connect to the emulator, download the latest SDK Platform Tools and then try again.
- If the emulator starts successfully, check the USB cable.
Check the USB cable
To check if the issue is being caused by a faulty USB cable, follow the steps in this section.
If you have another USB cable:
- Connect the device using the secondary cable.
- Check if the Connection Assistant can now detect the device.
- If the device is not detected, try the primary cable again.
- If the device still isn’t detected, assume that the problem is with the device and check if the device is set up for development.
If you don’t have another USB cable but you do have another Android device:
- Connect the secondary device to your computer.
If the Connection Assistant can detect the secondary device, assume that the problem is with the primary device and check if the device is set up for development.
If the secondary device is not detected, the problem might be with the USB cable.
Check if the device is set up for development
To check if the issue is being caused by settings on the device, follow these steps:
- Follow the steps in the Set up a device for development section.
- If this does not resolve the problem, contact the device OEM’s customer support for help. Tell the customer support representative that the device won’t connect to Android Studio using ADB.
RSA security key
When you connect a device running Android 4.2.2 (API level 17) or higher to your computer, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you’re able to unlock the device and acknowledge the dialog.
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.