Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 627
Nitzan Cohen Avatar asked Jun 14 '16 19:06

Nitzan Cohen


People also ask

Why Android Studio Cannot detect my phone?

If your device is not correctly detected in RAD Studio or in the system Device Manager, check the following: Ensure that your Android device is unlocked and not sleeping while connected via USB. Set the appropriate option in Settings or Developer Options. Make sure your Android device is enabled for USB debugging.

How can I see my device in Android Studio?

To do so, just click on “File transfer via USB touch for more options” in the notification area of the device. and then choose the PTP option. Then you will get a popup on your device regarding access. Just try restarting Android Studio to show up there as well though.

Does Android Studio work on Ubuntu?

You can install Android Studio on Ubuntu 22.04 using either the android-studio repository or Snap. In both cases you need to install JDK first which can be done using the command $ sudo apt install openjdk-11-jdk.


2 Answers

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.
like image 171
Himanshu Shankar Avatar answered Sep 24 '22 23:09

Himanshu Shankar


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.

like image 25
Ayush Khare Avatar answered Sep 24 '22 23:09

Ayush Khare