在 openSUSE 13.2中运行的 Android Studio Workspace 中的设备权限不足

我有一个根摩托罗拉 Defy + 运行 Cyanogenmod v11自定义 ROM (夜间构建)由 夸克斯创建。使用 Android Studio Workspace,(ASW) v. 1.1.0,当我尝试在这个设备上调试时,我得到

????????????[null]

显示在 ABc0窗口中,Logcat 窗口显示

insufficient permissions for device

我真的很想使用这个设备和 ROM 进行调试。

当我从命令行输入 lsusb时,

Bus 002 Device 002: ID 22b8:431d Motorola PCS

这是摩托罗拉设备的正确 ID。我安装了51号机器人。规则和71号机器人。规则在 /etc/udev/rules.d/与正确的摩托罗拉 ID 在这些文件。

我也试过 撤销 USB 调试权限,从 发展商方案在设备上,没有运气。

我没有试过以 root 用户身份运行 ASW,希望可能还有其他选项; 是否有其他选项?

更新: 我能够进入并访问 ADB

uvachem-gsmith2:/home/greg/Android/Sdk/platform-tools # ./adb

然后我做了一个 kill 服务器,对 root 用户做了一个 SU,并重新启动了服务器。然后我试着从 Android Studio 连接到这个设备。在设备上收到一条关于接受来自 PC 的 RSA 密钥的消息,说“是”,然后就可以将应用程序部署到设备上。那么回到我最初的问题,有没有其他方法可以访问这个设备而不用作为 root 用户登录?看起来好像是电话文件系统的许可问题阻止了这个..。

更新 # 2 这里的核心问题是权限问题。尽管以 root 身份运行 ADB 可以访问 根深蒂固 Android 设备,但更好的解决方案是更改该设备 udev 文件中的权限... ... 将664重置为666,(参见下面的答案)。这允许 PC 访问设备上的文件系统。

121471 次浏览

Changing permissions in this line from /etc/udev/rules.d/51-android.rules,

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="plugdev"

to,

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev"

resolves this issue in a manner that DOES NOT require running adb as root.

Long to short, I had the same problem with a Prestigio PMP5570C tablet,

all you have to do is to confirm on your tablet that you want to copy data to/from your computer (what i forgot), and add the 2 lines that @portsample wrote.

You can find the idVendor of your device typing

lsusb

in UBUNTU 12.04, then you get:

Bus 001 Device 011: ID 2207:0010,

where 2207 is your vendor id. Summed up the question and answer...

I found a simple answer that worked for me:

adb kill-server
sudo adb start-server
sudo adb devices

You will find your device then. Hope this helps.

Reference: http://itsfoss.com/fix-error-insufficient-permissions-device/

I had this while using a Linux machine with a Nexus 4 running Android 5.1

The fix was to enable both 'debug over USB' and 'connect as MTP'. The opposite is true when using the same device and Android Studio and adb on OSX though - to allow Android Studio to recognise the handset, I need to disable 'connect as MTP'.

For me and possibly many others the issue is to do with access rights to devices on the machine. Now that this is well documented in the android documentation, I think the best solution is here

On Debian based Systems you can run lsusb or dmesg to get vendor id if your vendor does not exist on the given list

IN my phone Symphony W75, in option USB computer connection-> selecting Connect as Media device(MTP) has solved the problem.

I have face the same problem and i have resolved this by Adding the path of your_android_sdk_path to the environment variable like

sudo export $PATH:/your_android_sdk_path/platform-tools/adb

its your wish how you want to add this to your account or system wide by editing these file ~/.bashrc file or ~/.profile or /etc/profile, /etc/bash.bashrc, or /etc/environment if u want to add to system wide access.

and then create the link of that in bin

sudo ln -s /your_android_sdk_path/platform-tools/adb /bin/adb

if you have used adb devices or any command then first kill the server like

adb kill-server

then start the server like

adb start-server
adb devices

now you can see your devices are listed properly without an issue

I updated my device (Nvidia Shield) that was previously connecting fine, so I knew that the PC setup is correct already. The developer settings seem to have a new layout on Android 7.0.

It is under Settings > Preferences > Developer options > Networking > Select USB configuration

Here, I needed to select PTP and everything works fine again:

Selecting USB configuration mode

As the error message said, it is a permission insufficient problem. In my experience, it only happened on my Linux machine, and works well on MacOS and Windows. Launching your Android Studio with root permission could avoid this problem.

$sudo /your_android_studio_path/bin/studio.sh

It's simple. Just change your USB mode to File Transfer mode then it works.

Android 8

MTP is no longer available. On my android 8 "Transfer Files" option did not work.

"Transfer photos PTP" Is worked, and Studio showed the device name.

  • Steps on your cell phone

    1. Open the developer options
    2. Enable USB debugging.
    3. change USB connection to PTP
  • Steps on Linux

    1. on console run sudo usermod -aG plugdev $LOGNAME

Android 9

With Android 9 use the option File Transfer.

What the F... ! :) Note : I have seen it on android 8.1 on a One+5t...

Even we do all of above, it is necessary to make something on your android device .. in addition to go in dev options menu (usb debug) (don't hesitate to reset "cancel authorization" or something like this (I am in french version ;) )

If some people meet the same problem than me, maybe it could be usefull for you too : Don't forget to authorize devices in your phone (each time of usb connect on the android device if you don't select always box). Beside, you can suppress the old authorized devices on your phone and start with proper parameter to authorize clearly your pc on your android device

When you connect the android device, a pop up or notification ask to authorize a mac address or equivalent to the device : authorize it if you want to authorize connection between your linux pc and your android device.

It is necessary to obtain autorisation on your android device when you use connect the usb cable (if you don't accept all the time but if it is the first time this box is going to appear on your devices) if you don't do it, adb devices show unauthorized even all rights are good (666, UDEV etc)

Note : thank you for your precious help. A last thing, sorry for my english

I made a script for this error. For me it works fine in Fedora 28, but it should work in many Linux distributions. Just create a file with the content of the selfexpanied script. I called it usbDebbugingAndroidStudio.sh
Give him execution permission with: chmod +x usbDebbugingAndroidStudio.sh

And run it: sudo ./usbDebbugingAndroidStudio.sh

After that check the list displayed by the command lsusb and introduce the Id of your device. For example: My output was: Bus 006 Device 002: ID 05c6:9091 Qualcomm, Inc. So I type 05c6 and press enter.

The script:

#!/usr/bin/env bash




#This script configure Android Debug Bridge permissions to solve the following
#error: com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device
#This error is produced when you try to install an APK from Android Studio in your device.
#You can check the vendorId here:
#https://developer.android.com/studio/run/device#setting-up
#If your device's brand isn't listed check the info displayed by the command lsusb


lsusb
#My output was:
#Bus 006 Device 002: ID 05c6:9091 Qualcomm, Inc.
#The id for this line is 05c6
echo -n "Enter the id of your mobile device: "
read usbProviderId
cd /etc/udev/rules.d/
sudo touch 51-android.rules
(
sudo cat << _EOF_
SUBSYSTEM=="usb", ATTR{idVendor}=="$usbProviderId", MODE="0666", GROUP="plugdev"
_EOF_
) | sudo tee 51-android.rules


#Give read and write permissions to the file
sudo chmod a+r /etc/udev/rules.d/51-android.rules


#Kill the Android Debug Bridge server to restart it
cd $HOME/Android/Sdk/platform-tools
sudo ./adb kill-server


#If this still doesn't work unplug the usb cable and connect again.
#And repeat the last step Kill the ADB server.

In my situation:

cd /etc/udev/rules.d/
sudo chmod a+r ./*.rules  #the name of your rules files.

Then,I can use adb without this error.

if accepted answer not worked for you then just simple follow steps: Just open your android studio terminal:-

adb kill-server

adb start-server

it worked for me.

This procedure solves the problem for me:

- On the Android device, drag the top menu and select "USB for file transfer"
- Press "Run" again
  • Enable USB debugging
  • Use USB to transer file

Go to Developer Options -> Default USB Configurations and Change to PTP

Run these two commands in terminal

 sudo adb kill-server
sudo adb start-server

Should Work!

Without running Linux sudo apt-get install adb. Don't forget to enable USB debugging.

Ref: https://developer.android.com/studio/run/device

I'm facing this issue while run flutter app from android studio 4.1, i did remove usb cable and plug into second usb port and its working :),

I'm writing this if someone face same issue then they can get help.

Same issue on Fedora 32, to fix this try this:

adb kill-server
adb start-server