Install some required package
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip libxml2-dev libxslt1-dev zlib1g-dev\
python2.7-dev python-scrapy libssl-dev gphoto2 libusb-1.0-0-dev checkinstall ant libphoto2* libmtpserver-dev libmtpserver-dev\
libgphoto2-2-dev libgphoto2-6:amd64 libgphoto2-dev libgphoto2-dev-doc libgphoto2-l10n libgphoto2-port10:amd64
Install JAVA
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
java -version
Ubuntu desktop of gnome setting by command
dbus-launch gsettings set org.gnome.desktop.media-handling automount-open false
dbus-launch gsettings set org.gnome.desktop.session idle-delay 0
dbus-launch gsettings set org.gnome.desktop.screensaver lock-delay 0
dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled false
dbus-launch gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend false
Auto login default user when launch host
sudo vi /etc/lightdm/lightdm.conf
[SeatDefaults]
autologin-user=USERNAME
Keep session case of via ssh remote access
if [[ -n $SSH_CLIENT ]]; then
BUS_ADDRESS=`ps -ef|grep -E "dbus-daemon.+--address"|awk -F '--address=' '{print $2}'`
if [[ -n $BUS_ADDRESS ]]; then
export DBUS_SESSION_BUS_ADDRESS=$BUS_ADDRESS
else
echo "Not found dbus-daemon process, please enable auto-login to the desktop and rebooting."
fi
echo DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS
fi
Install pip package
sudo pip install -U -r requirements.txt --proxy=proxy.xxx.com:8080
adium-theme-ubuntu==0.3.4
apt-xapian-index==0.45
arrow==0.8.0
astroid==1.3.2
autopep8==1.2.4
backports.shutil-get-terminal-size==1.0.0
BeautifulSoup==3.2.1
beautifulsoup4==4.5.0
bs4==0.0.1
certifi==2016.2.28
cffi==1.7.0
chardet==2.0.1
colorama==0.3.2
command-not-found==0.3
cryptography==1.4
dateutils==0.6.6
debtagshw==0.1
decorator==4.0.10
defer==1.0.6
dirspec==13.10
dlipower==0.2.75
docutils==0.12
duplicity==0.6.23
ecdsa==0.11
enum34==1.1.6
execnet==1.2.0
fileDownloader.py==0.4.0
flake8==2.1.0
fpconst==0.7.2
hashlib==20081119
html5lib==0.999
httplib2==0.8
idna==2.1
importlib==1.0.3
ipaddress==1.0.16
ipython==5.0.0
ipython-genutils==0.1.0
Jinja2==2.7.3
libusb1==1.2.0
linecache2==1.0.0
lockfile==0.8
logilab-common==0.61.0
lxml==3.3.4
MarkupSafe==0.23
mccabe==0.2.1
mock==1.0.1
ndg-httpsclient==0.4.1
oauthlib==0.6.1
oneconf==0.3.7.14.4.1
PAM==0.4.2
paramiko==2.0.1
pathlib2==2.1.0
pdfrw==0.1
pep8==1.7.0
pexpect==4.2.0
pickleshare==0.7.3
PIL==1.1.7
pil-compat==1.0.0
Pillow==3.3.0
piston-mini-client==0.7.5
prompt-toolkit==1.0.3
psutil==4.3.0
ptyprocess==0.5.1
py==1.4.31
py-dom-xpath==0.1
pyasn1==0.1.9
PyAudio==0.2.8
pycparser==2.14
pycrypto==2.6.1
pycups==1.9.66
pyflakes==0.7.3
Pygments==2.1.3
pygobject==3.12.0
pylint==1.4.0
pyOpenSSL==0.13
pypng==0.0.18
PyQRCode==1.2.1
pyserial==3.1.1
PySide==1.2.2
pysmbc==1.0.14.1
pytest==2.9.2
pytest-xdist==1.11
pytz==2016.4
pyxdg==0.25
PyYAML==3.11
reportlab==3.0
requests==2.10.0
rst2pdf==0.93.dev0
scipy==0.13.3
scp==0.7.2
sessioninstaller==0.0.0
simplegeneric==0.8.1
six==1.10.0
SOAPpy==0.12.5
traceback2==1.4.0
traitlets==4.2.2
Twisted-Core==13.2.0
Twisted-Web==13.2.0
tzlocal==1.2.2
uiautomator==0.2.6
unittest2==1.1.0
unity-lens-photos==1.0
urllib3==1.16
wcwidth==0.1.7
wstools==0.4.3
zope.interface==4.0.5
How to connect an Android device using MTP
sudo apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9
sudo vi /etc/fuse.conf
-----------------------------
#/etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE)
#Set the maximum number of FUSE mounts allowed to non-root users.
#The default is 1000.
#mount_max = 1000
# Allow non-root users to specify the allow_other or allow_root mount options.
user_allow_other
-----------------------------
sudo vi /lib/udev/rules.d/69-mtp.rules
-----------------------------
ATTR{idVendor}=="0fce", ATTR{idProduct}=="01b1", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
-----------------------------
sudo vi /etc/udev/rules.d/51-android.rules
-----------------------------
ATTR{idVendor}=="0fce", ATTR{idProduct}=="01b1", MODE=”0666"
-----------------------------
sudo udevadm control --log-priority=debug
sudo udevadm control --reload-rules
sudo service udev restart
sudo service udev restart
sudo reboot
Command change device USB mode
adb root
adb shell input keyevent 82
adb shell input keyevent 82
adb shell 'am start -S -n com.android.settings/.deviceinfo.UsbModeChooserActivity'
#instance 1 MTP 2 PTP
python -c "import uiautomator; uiautomator.device(className='android.widget.CheckedTextView', instance=1).click.wait(timeout=60000);"
Monitor commands
udevadm monitor --environment --udev
udevadm info -a -n /dev/bus/usb/xxx/xxx
read settings: adb shell getprop sys.usb.config
find valid settings: adb shell grep usb.config= /init*rc
change settings: setprop with the appropriate values (e.g. adb shell setprop sys.usb.config "mtp,adb" or adb shell setprop sys.usb.config "ptp,adb")
adb logcat -v threadtime |grep -E "`adb shell pidof com.package`|packagename"
Other commands
sudo lsof -i |grep 5037
sudo kill PID_NUMBER
pip list --outdated
android update project -p .
ant debug
ant clean release
--max-line-length 150