Win10下 ubuntu 编译安卓之软件环境搭建

 

目标:linux下命令行编译安卓版本。

win10自带ubuntu, 根据网上相关流程和设置,很顺利搞定,装了16.04的版本。

  • 1 先编辑更新源文件 /etc/apt/sources.list,我的如下:
deb http://mirrors.aliyun.com/ubuntu/ xenial main    
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main 

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main 
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main 

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted

deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
  • 2 软件包安装
sudo apt-get install git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev                                             // ok
sudo apt-get install git-core gnupg flex bison gperf build-essential                                // ok
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib                                  // ok
sudo apt-get install libc6-dev-i386                                                                 // new
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev                                 // ok
sudo apt-get install lib32z-dev ccache                                                              // ok
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4                                // ok

没有标ok的前面3行失败的,具体是里面带i386的包,提示:E: Unable to locate package libncurses5-dev:i386
 

root@DESKTOP-5RAQ5J5:/home/miaochi/vision_scanner# sudo apt-get install libncurses5-dev:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libncurses5-dev:i386

搞了半天没弄清楚问题在哪,最后一招是离线下载安装方法,但后来没用,

因为我想可能是跟我ubuntu的系统有关,因为本身是64位的,再验证下:

root@DESKTOP-5RAQ5J5:/home/miaochi/vision_scanner# sudo apt-get install libncurses5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libncurses5-dev is already the newest version (6.0+20160213-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

说明这个包在,应该没有问题。

就这样,把那些失败的行里,每个包再手动安装下,有:i386结尾的,把这尾巴都去掉(前提是你的系统是X86_64)

后面就是设置bash, 编译openjdk-8-jdk,make update-api 等事了。

注: 后来还是遇到了一些问题,放弃win10下的自带的ubuntu, 装双系统,用了18.04,发现上面的:i386的包都能用,也就是说上面的猜测也许并不准确,特此更正,18.04的更新源如下:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main universe

 

 

 

 

 

你可能感兴趣的:(Android)