How to compile CyanogenMod for the Android Emulator.
This how-to was written for Ubuntu 10.04 & Ubuntu 10.10, Android Emulator r08, CyanogenMod 7.x (Gingerbread), on 2 February 2011.

Prepare the Build Environment
VM中安装Ubuntu请分配足够大小,30GB,JDK先独立安装,之后安装的软件列表中就不需要"sun-java6-jdk"
NOTE: You only need to do these steps the first time you build. If you previously prepared your build environment, skip to Download RomManager.
Install the ADB
Install the Android SDK.
Install the Build Packages
Install using the package manager of your choice:

For 32-bit & 64-bit systems:
git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool

For 64-bit only systems:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
Note: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:
add-apt-repository "deb http://archive.canonical.com/ maverick partner"


Create the Directories
You will need to set up some directories in your build environment.
To create them:
mkdir -p ~/binmkdir -p ~/android/system


Install the Repository
Enter the following to download make executable the "repo" binary:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repochmod a+x ~/bin/repo

NOTE: You may need to reboot for these changes to take effect.
Now enter the following to initialize the repository:
cd ~/android/system/repo init -u git://github.com/CyanogenMod/android.git -b gingerbreadrepo sync -j16


Download RomManager
NOTE: This only needs to be done when an update to RomManager is released. If you are-up-to date, you may skip to Building CyanogenMod.
Download ROM Manager which is needed by the build:
cd ~/android/system/vendor/cyanogen/./get-rommanager


Building CyanogenMod
Check for updates
First, check for updates in the source:
cd ~/android/system/repo sync


Configure Build
Now, your environment must be configured to build specifically for the Android Emulator. To set up your build environment:
. build/envsetup.shlunch cyanogen_generic-eng


Compile
Next, we will build the actual ROM.
mka


重要:在编译前先执行make update-api,在执行mka进行编译,否则会报错,具体原因是CM中添加了新的API

Install
Create a folder called android-9-cyanogen on Your/Android-SDK/platforms/
Copy the contents of Your/Android-SDK/platforms/android-9 into Your/Android-SDK/platforms/android-9-cyanogen
Copy the ramdisk.img system.img and userdata.img file from ~/android/system/out/target/product/generic to Your/Android-SDK/platforms/android-9-cyanogen/images/
Run the Android AVD Manager and select the second Android 2.3 target.

重要:安装上述方法执行后,模拟器黑屏
解决办法:在CM源码中找到kernel-qemu-armv7,位置在~/prebuilt/android-arm/kernel/kernel-qemu-armv7
将它拷贝到SDK相应目录,执行如下命令:
root@ubuntu:~/android-sdks/tools# ./emulator @cm -kernel /root/android-sdks/platforms/android-cm/images/kernel-qemu-armv7

更多相关文章

  1. Pycharm安装PyQt5的详细教程
  2. 用命令行编译APK(英文版)
  3. eclipse ADT在线安装 https://dl-ssl.google.com/android/eclips
  4. Android运行底层linux外部命令的实现
  5. Windows下Eclipse 安装 android maven插件教程
  6. Android(安卓)单元测试 Robolectric
  7. Android应用程序常见编译问题解决
  8. Android:UI更新方法四:在Worker Thread中runOnUiThread直接刷新U
  9. android 执行shell命令代码

随机推荐

  1. 【整理】学习Android(安卓)Studio时遇到
  2. Unity接入Android广告: 三、Android端接入
  3. Android(安卓)解压boot.img
  4. 2018年 第二波~Android(安卓)库
  5. Android(安卓)BigDecimal工具类
  6. [Android(安卓)Pro] 有关Broadcast作为内
  7. Android中Activity布局及其加载
  8. android BroadcastReceiver相关
  9. Android(安卓)getView中的position问题解
  10. Android的volley框架心得