3

I encountered error like "(user in plugdev group; are your udev rules wrong?", After googled, I found some key refers:

It seems I should have fixed my error since I found Ref 2 as above; As Android Developer docs say:

Ubuntu Linux: Use apt-get install to install the adb package. This gives you a community-maintained default set of udev rules for all Android devices.

I was confused because I had env variable ANDROID_HOMEon 16.04LTS(my current use) and export two below which I DO NOT install adb with apt-get install adb.

# set android adb tools
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

I checked /etc/udev/rules.d/ which have 170-snap.core.rules 70-snap.vlc.rules. Was that(not install apt-get install adb) I missed this file /etc/udev/rules.d/51-android.rules? Answer is NO.

  1. Which adb package I should use on Ubuntu 16.04LTS, "~/Android/Sdk/platform-tools/adb" or "sudo apt-get adb"?

    As danzel(nice and humorous person below) and Andoroid developer docs suggest, I keep two export as mentioned above and sudo apt-get install adb for a community-maintained default set of udev rules for all Android devices.

  2. Should I add this 51-android.rules to /etc/udev/rules.d/ meanwhile I backup thoes two 70-snap.core.rules 70-snap.vlc.rules?
    1. They have no relationship.
    2. As Android developer docs(webpage language as Chinese or '中文-简体') say, developers create /etc/udev/rules.d/51-android.rules file as root or sudo command, use chmod a+r /etc/udev/rules.d/51-android.rules change privilege of this file. Add rule into this file, check Solution 3.
    3. Other files are NOT mentioned, so don't touch them.
  3. Will be caused unreversed errors for my developer computer env?

    I laughed myself just as danzel(nice and humorous person below) said "the inverse operation of creating a file is deleting it";

Latest updated: 2019-09-02

  • You can use whichever adb you want. The suggestion to install adb via apt is for the sole purpose of obtaining the community maintained udev rules (and updates thereof). The udev rules you mentioned are not related to adb, just leave them as they are. Does this answer your questions? I honestly don't really understand your actual problem. – danzel Aug 30 '19 at 7:19
  • 1
    Yes, /etc/udev/rules.d/ is the correct directory. As I said, don't touch the existing (unrelated) rules files. They could be overwritten by the packages that provided them in the future. Additionally, the number at the beginning of the filename (or, more precicely, the whole filename) determines the order in which the rules are applied. There is probably a reason for the 51 and the rules may not work if they are applied later. As for your third question (sorry for the sarcasm): the inverse operation of creating a file is deleting it. – danzel Aug 30 '19 at 9:57
  • 1
    However, if you don't mind having an additional adb installation (which you don't have to use), you can just install adb via apt (sudo apt install adb) which will install (and update) the appropriate udev rules so you don't have to add them manually. – danzel Aug 30 '19 at 10:02
  • 1
    @danzel Thx a lot, I really appreciate it. I will update this question and post the right answer later. Maybe polish my not proper question. – Shanksiscool Sep 2 '19 at 1:46
  • 1
    @user.dz Developers create /etc/udev/rules.d/51-android.rules file as root or sudo command, use chmod a+r /etc/udev/rules.d/51-android.rules change privilege of this file. Add rule into this file, check Solution 3 know how to make a rule. – Shanksiscool Oct 21 '19 at 7:36
2

Answer: you need create sudo /etc/udev/rules.d/51-android.rules file as root privilege, then use sudo chmod a+r /etc/udev/rules.d/51-android.rules change privilege of this file. Add rule into this file, check Solution 3 know how to make a rule.

  • what does the number 51 mean? Sometimes I see 50, 51, or 70.... – ScottF Nov 10 '19 at 17:03
  • since it is out of my ability. Just googled the key might be Files in /etc/udev/rules.d/ are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. and Files in the custom rules directory override files of the same name in the default rules directory. Rules files are sorted and processed in lexical order., or you may find out by you own with help of link 1 and link 2 – Shanksiscool Nov 18 '19 at 9:30
1

There are some specific things to do for Ubuntu to make USB debugging work, described in this page on developer.android.com about setting up a device for development.

What it suggests is to run these two commands in terminal:

sudo usermod -aG plugdev $LOGNAME
sudo apt-get install android-sdk-platform-tools-common

The above package contains a community-maintained set of udev rules for Android devices.

Rebooting may be needed for the changes to take effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.