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
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.
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.
Tried all above, none worked .. finally worked when I switch connected as from MTP to Camera(PTP).
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
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.
Anyway, what I did to solve this problem(on Ubuntu).
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.
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.
.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
./adb devices
./adb kill-server
sudo ./adb devices
./adb kill-server
./adb devices