Ubuntu下搭建Android编译环境


Ubuntu一台新机器的一些环境搭建

新增一个3TB的硬盘,挂载方法,大于2TB的得parted来进行分区

1: sudo parted /dev/sda
2: mklabel gpt
3: unit TB
4: mkpart primary 0 3
5: quit
6: sudo mkfs.ext3 /dev/sda1
7: sudo blkid (看UUID)
8:写入到/etc/fstab 开机自动挂载



基础环境配置:
1:安装输入搜狗输入法
     1)安装fcitx libssh2-1
         查看是否安装
         dpkg -l | grep fcitx
         dpkg -l | grep libssh
         若没有,则安装     sudo apt-get install fcitx libssh2-1    
     2)下载搜狗官方的deb包
         32位:wget "http://pinyin.sogou.com/linux/download.php?f=linux&bit=32" -O "sougou_32.deb"
         64位:wget "http://pinyin.sogou.com/linux/download.php?f=linux&bit=64" -O "sougou_64.deb"
     3)安装下载好的deb包
         sudo dpkg -i sougou_64.deb
         可能会报错,没安装依赖包 libopencc2或libopencc1:amd64,那么就安装sudo apt-get install libopencc2
     4)设置系统的输入法
         Language Support --> keyboard input method system 选择fcitx,然后桌面右上角就可以选择搜狗输入法了,若没有,reboot


2:安装截图工具
        sudo apt-get install ksnapshot 截整个屏幕
        sudo apt-get install shutter   类似于QQ截图软件

3:当使用sudo执行的时候,每次都要输入密码,设置不要输入密码
        
        sudo vim /etc/sudoers 添加:username ALL=(ALL:ALL) NOPASSWD:ALL

4:设置右键有terminal选项
   sudo apt-get install nautilus-open-terminal

5:安装openssh-server(用来远程ssh)
        sudo apt-get install openssh-server

6:支持多种媒体格式
   sudo apt-get install ubuntu-restricted-extras    

7:谷歌浏览器安装
   下载:wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
        安装: sudo dpkg -i google-chrome-stable_current_amd64.deb
     若报错:dpkg: error: dpkg status database is locked by another process
     则       sudo rm /var/lib/dpkg/lock
               sudo dpkg --configure -a

8:安装vim
        sudo apt-get install vim




Android环境搭建:
1:查看系统版本信息
  lsb_release -a
    No LSB modules are available.
    Distributor ID:    Ubuntu
    Description:    Ubuntu 14.04.4 LTS
    Release:    14.04
    Codename:    trusty

2:换源
   http://mirrors.163.com/.help/ubuntu.html  找到对应的版本
        cd /etc/apt/source.list
        sudo wget http://mirrors.163.com/.help/sources.list.trusty   下载
        cp sources.list sources.list.bak               备份原来的
        sudo cp sources.list.trusty sources.list           替换
   sudo apt-get update

3:安装JDK
         1) sudo apt-get install openjdk-7-jdk
       2)   sudo update-alternatives --config javac
                 sudo update-alternatives --config java
         3) 导入环境
         export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
            export JRE_HOME=$JAVA_HOME/jre
            export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
            export PATH=${JAVA_HOME}/bin:$JRE_HOME/bin:$PATH
          
4:安装依赖包
     sudo apt-get install build-essential make gcc g++ libc6-dev texinfo libncurses-dev git-core gnupg flex bison zip curl ncurses-dev libsdl-dev zlib1g-dev libxml2-utils lzma
       sudo apt-get install gcc-multilib
     sudo apt-get install bison g++-multilib git gperf libxml2-utils make zlib1g-dev:i386 zip
     sudo apt-get install flex bison gperf curl zlib1g-dev g++-multilib g++-4.4-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z1-dev wine mingw32 tofrodos libgl1-mesa-dev  
     sudo apt-get install gnupg libncurses5-dev:i386 libx11-dev:i386 libreadline6-dev:i386 python-markdown xsltproc
     sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
       

5:安装git
          sudo apt-get install git

6:repo下载
          mkdir ~/bin   
          PATH=~/bin:$PATH  
          curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo 
          chmod a+x ~/bin/repo
            
           或者
          curl https://storage.googleapis.com/git-repo-downloads/repo > repo   
          chmod +x repo
                            cp repo /usr/bin
            
 
           
7:下载代码测试
          repo init -u  ...
          repo sync
          source build/envsetup.sh
          lunch ...(选择编译的类型)
          make



MTK工具的安装:
      1) sudo usermod -a -G dialout $USER
      2) sudo reboot
      3) sudo apt-get remove modemmanager
      4) sudo service udev restart
      5) lsmod | grep cdc_acm
      6) sudo modprobe cdc_acm
         然后就可以烧录了....


























你可能感兴趣的:(Ubuntu下搭建Android编译环境)