问题
I have tried:
Basic tutorial in Android Developers: http://developer.android.com/intl/es/tools/device.html
I think the problem is in udev rules, so I tried this: https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules
But I can't get my phone connected in Android Studio.
回答1:
I'm sorry, the problem was just de configuration on the phone. I have ennable Developer options. But not USB debugging.
回答2:
The procedure is fairly simple. But before you dive into the tweaking part, ensure that your phone is set as MTP in USB computer connection.
Open a terminal window and type,
lsusb
Find your device in the output and note down the ID. Let's assume, it is 22b8:2e76
. The first part(22b8
) is the vendor ID the last part is the product ID(2e76
).
Now open up the corresponding mtp udev rules file by typing the following into terminal,
sudo gedit /lib/udev/rules.d/69-libmtp.rules
You'll see there are many smartphones listed there. Search for your phone's product ID. Here in this case, it should be 2e76 . If you can't find it, it means you have to create a custom entry by following the pattern below.
#Motorola Moto G (MTP+?)
ATTR{idVendor}=="22b8", ATTR{idProduct}=="2e76", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
Copy the above code and paste it after the last Motorola phone enlisted in that file. Simply search with the word 'Motorola' and you'll find all of the Motorola devices. In my case, the last device was Motorola XT890/90. So, I've added the above code right after Motorola XT890/907's code.
Save & close the editor. Reboot computer and plug the phone to computer again. It should be mounted as mass storage device and work in Android Studio now.
Hope it helps.
来源:https://stackoverflow.com/questions/33544481/connect-moto-g-xt1032-by-udev-ubuntu-for-android-studio