Welcome 微信登录

首页 / 操作系统 / Linux / Android开发之Fedora 13下编译Android源码

作为一个C++程序员,学习了一段时间的Android上层应用的开发,总感觉摸不到下面的东西不稳当,有点飘。今天心血来潮下载源码自己编译了一把。没有Ubuntu,直接在我Fedora 13上编译,下面把编译过程记录一下。网上也有很多相关内容,我写的也不一定全面,就是当做日志给我自己记录一下。1.       建立目录:mkdir ~/binPATH = ~/bin:$PATH2.       下载下载工具yum install gitcurl https://android.git.kernel.org/repo > ~/bin/repochmod a+x ~/bin/repo3.       建立工作目录mkdir myAndroidcd myAndroid4.       运行repo来初始化       repo init –u git://android.git.kernel.org/platform/manifest.git5.       获取文件       repo sync –j46.       开始在根目录下make       source build/envsetup.sh       lunch full-eng       make7.       下面就开始make了,出什么错解决什么错就可以了。下面是错误列表和解决方式:a)         提示javac找不到——> 运行yum install java*b)        提示g++找不到——>运行g++c)         提示bison找不到——>运行yum install bisond)        提示flex找不到——>运行yum install flexe)         提示cannot find –lncurses——>运行yum install ncurses-develf)         提示cannot find –lhistory——>运行yum install readln-staticg)        提示:error while loading shared libraries … … lib/libdvm.so … cannot resore segment prot after reloc : Permission denied.——>解决办法:编辑etc/sysconfig/selinux 和 etc/selinux/config文件,将SELINUX = enforcing 改为SELINUX = disable;然后运行命令:chcon –t texrel_shlibt /…/…/lib/libdvm.so。h)        提示commond not found gperf——>运行 yum install gperf。 8.       编译出的东西都在out目录下。编译完成后,看看out/target/product/generic/目录下是否有如下文件:
out/target/product/generic/obj/PACKAGING/systemimage_unopt_intermediates/system.img
Install system fs image: out/target/product/generic/system.img
Target ram disk: out/target/product/generic/ramdisk.img
Target userdata fs image: out/target/product/generic/userdata.img如果有这些镜像文件,说明编译成功了。可以在out/host/linux-x86/bin下运行./emulator这样一个模拟器就起来了,这个模拟器就是你自己编译出来的。9.       在编译过程中可能会出现Clock skew detected.your build may be incomplete.如果有上面的文件,忽略这个警告信息。如果没有的话,需要解决。解决方法:find –type f | xargs –n 5 touchmake cleanmake其中make clean的执行需要小心,它将删除已经编译完成的文件。10.   编译完成以后,就可以“想干什么就干什么了… …”