android studio doesn't detect my device on my ubuntu laptop

笑着哭i 提交于 2019-12-09 11:45:11

问题


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


回答1:


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.



回答2:


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.



回答3:


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.



回答4:


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.




回答5:


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



来源:https://stackoverflow.com/questions/37820656/android-studio-doesnt-detect-my-device-on-my-ubuntu-laptop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!