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 :(
First of all,
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.
Troubleshooting:
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{idVendor}=="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)
Again, the process:
Create a file: /etc/udev/rules.d/51-android.rules.
Write: SUBSYSTEM=="usb", ATTR{idProduct}=="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.
Make sure you have adb installed in your ubuntu system.
If not then type -
sudo apt-get install adb
Provide your system password and press 'Y' asked during installation process.
Then disconnect your device through USB and then reconnect it.
You will have to grant permission for debugging which prompts on your device just after reconnecting.
I faced the same issue but it was my mistake. I didn't turn on the " USB DEBUGGING MODE ".
Settings > Developer Option > Enable USB Debugging Mode.
Try to revoke USB debugging authorizations and then connect your device, it should show permission prompt for authorization.
go to
settings -> developer options -> revoke USB debugging authorizations.
I tried restarting adb using root priviledges and it worked for me. Use these commands in the terminal:
sudo adb kill-server
sudo adb start-server
Hope it works for you too...
For my situation with Ubuntu 16.04, with my device properly connected via USB, confirmed by lsusb
The solution is let the Studio aware of the Android/Sdk folder by defining
export ANDROID_HOME=<the Android/Sdk folder>
in ~/.bashrc
(I have installed the SDK at a custom location)
Then start a new shell, from there re-start the studio, then it works.
I solved with this: https://stackoverflow.com/a/37109216/5081063
If the problem is only on Android Studio and not in your OS you can solve with that.
So first check if adb recognize any devices with:
$ adb devices
If yes, open Android Studio and follow these steps:
Go to Run > Edit Configurations...
Under Deployment Target Options select Show Device Chooser Dialog from the drop-down-list
if you are doing it first time in Ubuntu Linux, then Use sudo apt-get install to install the adb package. This gives you a community-maintained default set of udev rules for all Android devices.
or, use
sudo adb kill-server
sudo adb start-server
and check using
sudo adb devices
you can also check uncheck the usb debugging option, in your developer option in the phone.
follow this link for more info.
Run apps on a hardware device
Enable USB Debugging from Settings->Developer Options
Enable Developer Mode by clicking on build number several times
My device appeared as unrecognized and when I ran adb devices fom android-tools directory it said: adb not a command. Strange. So what I did is installed adb tools additionally and then run adb devices:
sudo apt-get install android-tools-adb
89LY0810Y unauthorized
Then I saw the dialog on my device and selected: Always authorize.
Please make sure your device is in debug mode.
If you have tried many terminal commands to connect your physical device to android studio in ubuntu and you failed to connect try this :- Connect your device and change your USB preference(device notification) to PTP,android studio will detect your device.see this image
I had the same problem, as I had enabled the USB Debugger but it was my first try so I didn't know what to expect. If you answer "yes" to "use as storage device," you will set it to mtp, if you answer no, after that you will have the option to connect on debug mode and it will appear.
I was using a Samsung A31 and Debian
After trying a lot of different solutions, I notice that the problem was my cable, so I changed it and now it works.
Thanks to RazorHail Answer.
Related
I have an Android tablet and an old Linux notebook where I developed a program for months, no glitches.
Then I got a new Linux notebook, installed Android Studio, and tried to plug in the Android tablet. The tablet never shows up in the target list; it just says, "Unknown Device." When I select "Troubleshoot device connections," the wizard displays the ID of the tablet, with the cryptic message "Device is currently in the unknown state."
Turning the tablet's "USB debugging" option off and on again does not fix the problem. When I unplug and replug the USB, the tablet chimes, but does not put up a requestor asking if I accept this debugging connection.
Running adb devices returns:
$ adb devices
List of devices attached
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
B007904026445 no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]
Any tips?
Unplugging and plugging in the USB just one more time finally gave me the requestor on the tablet asking for permission to be debugged by this notebook. End of crisis.
An actual answer how to get that requestor without USB cable abuse would be nice...
while connecting Android phone to computer Select 'File transfer' option in 'Use USB for ' Dialog. this will solve the issue.Tested.
I ran into this issue when connecting a Pixel 2 XL running Android 11 via USB (with USB debugging on). The solution here worked for me:
Run
sudo adb kill-server
and then
sudo adb start-server
then connect your device turn Debugging on and type
adb devices
again. After doing this, the Pixel 2 showed up in the list of devices in Android Studio.
I came across the same issue. By scanning for devices in troubleshooting connections after installing adb, it showed me directly the request for pairing the device. I have similar set up and One Plus 3
Select Revoke USB debugging authorizations to revoke access to all computers you've previously authorized (Settings > System > Developer Options > Debugging).
See more in this post
https://developer.android.com/studio/run/device
add yourself to the plugdev group: sudo usermod -aG plugdev $LOGNAME
install sudo apt-get install android-sdk-platform-tools-common
log out and log in again for the group changes to take effect
If it's still not working, try to:
disable and enable "USB-Debugging" on your developer settings of your Android phone
If it's still not working a not so great workaround is restarting the adb server. Not so great, because adb should not run as sudo:
cd / && sudo find -name "adb" # ADB_PATH
sudo ADB_PATH/adb kill-server
sudo ADB_PATH/adb start-server
sudo ADB_PATH/adb devices
This can happen if you have Chrome inspect or other similar software hanging
in my case I had this error because I was connecting to a HUB USB.
It also happened to me, when I tried to connect my Android Phone in Android Studio.
On my Phone i got the message "USB debugging connected" but the pop-up Window that asks for "allow USB debugging" never showed up. Also in Android Studio the code wasn't uploadable to my Phone.
I also got "Device is currently in the unknown state" in Troubleshoot Device Connections.
The Problem was: my Settings (Connected Devices > USB Preferences) on my Phone were set to "No data Transfer".
I had to enable "File Transfer"
I tried to use my Acer Chromebook tab to debug my app in Android Studio but I have some troubles ...
I followed this documentation : https://developer.android.com/topic/arc/development-environment#debug_with_adb
The last command I typed is "sudo ectool usbpd 0 dr_swap"
And when I type sudo "ectool usbpd 0", I have this :
"Port C0: enabled, connected State:SNK_DISCOVERY Role:SNK UFP, Polarity:CC1"
I have nothing in Android or when I use sdk tools with the command "adb devices", the list is empty.
Could you help me please ?
It looks like from your question that you are attempting to debug using USB rather than using ADB over network. Since you mentioned that you are using an Acer Chromebook, I do not believe that they support USB debugging (based on this Chromium Document).
Instead, what I would encourage is that you utilize ADB over network instead (don't forget to put your laptop in developer mode).
I have a Samsung Galaxy S8 and whenever I try to debug an app in Android Studio the app crashes and disconnects the phone from the PC.
I don't know if it's the drivers for the phone that I need to re-install or if there is a bug in the operating system or maybe something else.
I'm running Android Studio 3.1 under Linux Mint 18.3 Sylvia edition, and I'm running KDE.
Yes, there is a driver for Linux. You can get it from here:
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
try following these steps to set it up correctly (I have it from https://www.xda-developers.com/install-adb-windows-macos-linux/)
Extract the ZIP to an easily-accessible location (like the Desktop for example).
Open a Terminal window.
Enter the following command: cd /path/to/extracted/folder/
This will change the directory to where you extracted the ADB files.
So for example:cd /Users/Doug/Desktop/platform-tools/
Connect your device to your Linux machine with your USB cable. Change the connection mode to “file transfer (MTP)” mode. This is not always necessary for every device, but it’s recommended so you don’t run into any issues.
Once the Terminal is in the same folder your ADB tools are in, you can execute the following command to launch the ADB daemon: adb devices
Back on your smartphone or tablet device, you’ll see a prompt asking you to allow USB debugging. Go ahead and grant it.install adb
Finally, re-enter the command from step #7. If everything was successful, you should now see your device’s serial number in the Terminal window output.
When I start the ADB in command line:
$ sudo adb start-server
I get message like this:
* daemon not running. starting it now in port 5037 *
* daemon started successfuly *
And after this system(Ubuntu 16.04(x86_64)) completely freezes.
How I can fix this problem?
UPD: I run
strace adb start-server
and get, which system freezed on command nanosleep.
on my system i have solved my problem with plugging in laptop power.
when my laptop is connected to power cord. adb works. and when i is on battery its gonna freeze.
i think this is something with Acpi.
another solution:
to start using adb when i am on battery:
sudo tlp ac
and when i want to quite:
adb kill-server
sudo tlp start
Try upgrading to 16.10 and make sure you have the following set in your BIOS:
- From Legacy to UEFI boot
- Disabled USB 3.0 legacy
Ref: https://ubuntuforums.org/showthread.php?t=2313496
I choose poprietary driver and this work, but not all time, sometimes this problem repeated.
I was having the same problem on my archlinux system (with ANY version of the kernel).
The problem for me seems to be the usb auto-suspend function of tlp. I've disabled it completely setting:
USB_AUTOSUSPEND=0
And for the moment it seems to have solved the problem.
EDIT: It wasn't the usb autosuspend i had to uninstall completely tlp to make it work until i can investigate this further.
Fo me, it was tlp
Edit the conf file at /etc/default/tlp
I did
USB_AUTOSUSPEND=0
and
USB_BLACKLIST_PHONE=1
Maybe you don't need to put USB_AUTOSUSPEND=0
EDIT: doesn't seem to work anymore.
Right now, I have my Android SDK and ADB set it up on my Linux system. I have created an emulator under Android AVD Manager and it runs. The problem is that I am trying to connect to an emulator using ADB shell but every time when I do
adb devices
there is nothing being listed under the command. But when I physically connect an Android device into a computer, adb is able to recognize the physical device.
I have tried
adb kill-server
and
adb start-server
I have also ran everything under ROOT privileges and can't happen to narrow down what is the problem.
If you haven't already, please enable "USB Debugging" in the the emulated Android instance. If you already have, what is the output of lsusb? Are the ports open? Scan 5037 and 5500-5600 on the emulators IP address (assuming you are using a UNIX-based OS and have networking enabled in the emulator).
(see also: https://developer.android.com/tools/help/adb.html)