set up device for development (???????????? no permissions)

后端 未结 26 2073
再見小時候
再見小時候 2020-11-22 12:27

I am using a Samsung galaxy nexus phone (Android 4.0 platform) .

I am developing Android app on Ubuntu linux OS. I would like to run my application

相关标签:
26条回答
  • 2020-11-22 13:11

    Please DO NOT follow solutions suggesting to use sudo (sudo adb start-server)! This run adb as root (administrator) and it is NOT supposed to run like that!!! It's a BAD workaround!

    Everything running as root can do anything in your system, if it creates or modify a file can change its permission to be only used by root. Again, DON'T!

    The right thing to do is set up your system to make the USER have the permission, check out this guide i wrote on how to do it properly.

    0 讨论(0)
  • 2020-11-22 13:13

    You could also try editing adb_usb.ini file, located at /home/username/.android/. This file contains id vendor list of devices you want to connect. You just add your device's id vendor in new line (it's one id per line). Then restart adb server and replug your device.

    It worked for me on Ubuntu 12.10.

    0 讨论(0)
  • 2020-11-22 13:14

    Tried all above, none worked .. finally worked when I switch connected as from MTP to Camera(PTP).

    0 讨论(0)
  • 2020-11-22 13:15

    Only for Ubuntu/ Debian users: There are some specific things to do for ubuntu to make USB debugging work: described here: https://developer.android.com/studio/run/device Here are the two steps mentioned. Run this two command in terminal:

    sudo usermod -aG plugdev $LOGNAME
    sudo apt-get install android-sdk-platform-tools-common
    
    0 讨论(0)
  • 2020-11-22 13:17

    Use the M0Rf30/android-udev-rules GitHub community maintained udev-rules

    https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules

    This is the most complete udev-rules list I've seen so far, even more than the currently recommended sudo apt-get install android-tools-adb on the official documentation, and it solved that problem for me.

    0 讨论(0)
  • 2020-11-22 13:17

    Anyway, what I did to solve this problem(on Ubuntu).

    1. Defined in what cases I need to run these commands. For most ubuntu users there is a home folder (hidden file .bashrc).

      In which you can record the launch of these commands. But these commands will be triggered when you enter the bash command in the console.

    2. Since I have a shell .zshrc then I did the following:

      open console: gedit .zshrc

    When the file opens, add the following line:

    ./.add_device_permissions.sh
    

    After or before, we need to create this file: .add_device_permissions.sh in which we write the following:

    #!/bin/bash
    # Add permissions
    ADB="/home/vadimm/Android/Sdk/platform-tools/adb"
    $ADB devices
    $ADB kill-server
    cat .permissions_redmi_note | sudo -S $ADB devices
    $ADB kill-server
    cat .permissions_redmi_note | sudo -S $ADB devices
    

    Also we need create .permissions_redmi_note where we need to hardcode our password.

    1. Not to add to the file .zshrc unnecessary we can specify the path when starting the system itself: Startup Applications Preferences

    Where we press on "Add" and write our command: /home/vadimm/.add_device_permissions.sh

    1. Also u can tried use in command line next commands: ./adb devices ./adb kill-server sudo ./adb devices ./adb kill-server ./adb devices
    0 讨论(0)
提交回复
热议问题