14

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 :(

Zoe
  • 27,060
  • 21
  • 118
  • 148
Nitzan Cohen
  • 151
  • 1
  • 1
  • 4

13 Answers13

25

First of all,

Open terminal and do following:

  1. Do lsusb command to check your device is indeed connected.

  2. 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:

  1. Make sure adb mode in enabled.
  2. Make sure you have opted for Allow option when prompted for in your device upon connecting to your ubuntu system.
  3. This one is from some past LG users, Try connecting your device in PTP mode rather than MTP mode, it surprisingly works.
  4. 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:

  1. Create a file: /etc/udev/rules.d/70-android.rules.
  2. Write: SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666" to the file.
  3. Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
  4. 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:

  1. Create a file: /etc/udev/rules.d/51-android.rules.
  2. Write: SUBSYSTEM=="usb", ATTR{idProduct}=="1004", MODE="0666" to the file.
  3. Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
  4. Reboot the system and restart udev.
Community
  • 1
  • 1
Himanshu Shankar
  • 735
  • 1
  • 6
  • 24
11

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.

Ayush Khare
  • 161
  • 1
  • 4
9

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.
Fazal
  • 3,374
  • 1
  • 15
  • 20
6

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.
digiwizkid
  • 791
  • 2
  • 14
  • 28
3

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...

KRHero
  • 31
  • 2
2

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.

Yu Shen
  • 2,770
  • 3
  • 33
  • 48
1

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:

  1. Go to Run > Edit Configurations...
  2. Under Deployment Target Options select Show Device Chooser Dialog from the drop-down-list

enter image description here

Stefano Borzì
  • 1,019
  • 1
  • 15
  • 32
1
  1. 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.

  2. or, use sudo adb kill-server sudo adb start-server and check using sudo adb devices

  3. 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

subrata sharma
  • 344
  • 4
  • 17
1
  1. Enable USB Debugging from Settings->Developer Options

  2. Enable Developer Mode by clicking on build number several times

Jonathan
  • 1,955
  • 5
  • 30
  • 50
0

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.

i_tanova
  • 667
  • 4
  • 5
0

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

0

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

Raydot
  • 1,458
  • 1
  • 23
  • 38
MVei
  • 1
  • 1
-1

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.

manoellribeiro
  • 187
  • 2
  • 5