ubuntu16.04编译android源码

解决ubuntu16.04编译android L和M报错问题

Posted by LXG on April 4, 2019

Android L

1.切换Java版本到1.7

sudo update-alternatives –config java
sudo update-alternatives –config javac

2.ld文件覆盖

cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/x86_64-linux/bin/ld
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld

3.切换make版本到3.8.1

目前只能单独编译systemimage, 编译命令如下 ./sunmi/software/make-3.81/make systemimage

Android M

cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/x86_64-linux/bin/ld
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld

另外一种环境变量配置方法

  1. sudo apt-get update
  2. sudo apt-get install lrzsz
  3. sudo apt-get remove openjdk*
  4. download jdk 1.7
  5. cd usr/local/
  6. mkdir java
  7. cp jdk1.7 /usr/local/java
  8. sudo vim /etc/profile
  9. source /etc/profile
  10. java -version

JAVA_HOME=/usr/local/java/jdk1.7.0_72
	CLASSPATH=.:$JAVA_HOME/lib.tools.jar
	PATH=$JAVA_HOME/bin:$PATH
	export JAVA_HOME CLASSPATH PATH