Setting Ubuntu16.04 environment for android

2017-08-10 10:55:07来源:oschina作者:bo_zhang人点击

分享

1, sudo apt-get install openssh-server


sudo service ssh restart

2, sudo apt install git


git config --global user.name "xxx"


git config --global user.email xx.xxxxx@xxx.com


git config --global core.editor vim

3, clone some useful git


git clone https://github.com/damonkohler/sl4a.git

4, clone and sync android aosp code


sudo apt-get install vim


sudo apt install curl


curl https://storage.googleapis.com/git-repo-downloads/repo > ~/repo


chmod a+x ~/repo


mkdir maddev_o-ear


cd maddev_o-ear/


./repo init -u https://android.googlesource.com/platform/manifest


./repo sync

5, setup java environment (install java)


sudo apt-get update


sudo apt-get install openjdk-8-jdk

6, compile android code (need lzop at first)


sudo apt-get update


sudo apt-get install lzop


sudo apt-get install device-tree-compiler


sudo apt-get install m4


sudo apt-get install bison


sudo apt-get install g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev


sudo apt-get install libxml2-utils

7, change java setting


zhangbo@OptiPlex-7020:~/maddev_o-ear/prebuilts/sdk/tools$ vi jack-admin


diff --git a/tools/jack-admin b/tools/jack-admin


index 96a4dc3..abc5bba 100755


--- a/tools/jack-admin


+++ b/tools/jack-admin


@@ -484,7 +484,7 @@ case $COMMAND in


if [ "$RUNNING" = 0 ]; then


echo "Server is already running"


else


- JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"


+ JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx2048M -cp $LAUNCHER_JAR $LAUNCHER_NAME"


echo "Launching Jack server" $JACK_SERVER_COMMAND


(


trap "" SIGHUP

Change the jack server setting(port number) to others if exist other project in the same server:


vi ~/.jack-settings


vi ~/.jack-server/config.properties


SERVER_PORT_SERVICE=8076


SERVER_PORT_ADMIN=8077


jack.server.service.port=8076


jack.server.admin.port=8077

ps axu |grep jack


jack-admin kill-server


cd prebuilts/sdk/tools && touch jack && cd ../../../


jack-admin start-server

8, install useful tools


sudo apt install ckermit


vi ~/.kermrc


set line /dev/ttyUSB1


set speed 115200


set carrier-watch off


set handshake none


set flow-control none


robust


set file type bin


set file name lit


set rec pack 1000


set send pack 1000


set window 5


Connect and open console:


kermit -c


Enter command line mode:


[Ctrl]/


Quit in command line mode:


Exit

sudo apt-get install samba


sudo apt-get install smbclient


sudo vi /etc/samba/smb.conf


[share]


comment=this is Linux share directory


path=/home/zhangbo


available = yes


browseable = yes


public=yes


writable=yes


create mask = 0644


directory mask =0777


force user = zhangbo


force group = zhangbo

Create samba account (must be an account exist in system):


sudo touch /etc/samba/smbpasswd


sudosmbpasswd-azhangbo

sudo /etc/init.d/samba start


sudo /etc/init.d/samba stop


sudo /etc/init.d/samba restart

9, install download and debug tools:


sudo apt install android-tools-fsutils


sudo apt install android-tools-adb


sudo apt install android-tools-fastboot


sudo adb kill-server


sudo adb devices

8, download error: simg2img: command not found******not work


sudo apt install android-tools-fsutils

9, set system time


tzselect


sudo date -s "2017-08-08 14:22:00"


[sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime]

微信扫一扫

第七城市微信公众平台