在OpenSuSE上编译CyanogenMod全过程(备考版)
在OpenSuSE上编译CyanogenMod全过程(备注版)在OpenSuSE12.1RC2下编译CyanogenMod的全过程,主要是按照官方
在OpenSuSE上编译CyanogenMod全过程(备注版)
在OpenSuSE12.1RC2下编译CyanogenMod的全过程,主要是按照官方的文档操作,增加了注意事项和异常处理(绿色粗体部分),欢迎交流。
原文链接:http://wiki.cyanogenmod.com/wiki/Android_SDK_Emulator:_Compile_CyanogenMod_(Linux)
?
Android SDK Emulator: Compile CyanogenMod (Linux)
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.
Contents?ADB
ADBInstall the?Android?SDK.android/systemmake?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?http://github.com/CyanogenMod/android.git?-b gingerbreadrepo sync -j16
NOTE:1、完整下载约5G多,下载过程不能断网;2、实际表明,使用http连接方式获取代码更佳;3、如果下载过程断链出错退出,或者手动kill过python进程,在执行sync之前需要删除临时文件:find .repo/ -name tmp* -exec rm {} \;4、如果下载完成,长时间等待下面提示时;?Fetching projects: 98% (208/211)? 则需要kill掉python进程,去掉 -j16 参数再次同步repo sync5、如果下载过程中报某个目录一直出错,则需删除该目录再同步6、如果想少下载一些文件,则可以不下载针对具体设备的代码(可以减少下载2G左右的内容),方法如下:a. repo init 执行完毕后,编辑 .repo/manifest.xml 文件,注释掉device相关的projiect,如下ROM?Manager which is needed by the build:cd ~/android/system/vendor/cyanogen/
./get-rommanager
android/system/repo sync
Android?Emulator. To set up your build environment:. build/envsetup.sh
lunch cyanogen_generic-eng
NOTE:1、新建shell进入工作目录之后都需要执行上述命令2、如果想彻底重新编译,需执行 make clean3、FOR OPENSUSE:? ?去掉OpenSuSE普通用户下执行envsetup.sh的提示:修改?schedtool?为?/usr/sbin/schedtool 即可。function mka() {? ? case `uname -s` in? ? ? ? Darwin)? ? ? ? ? ? make -j `sysctl hw.ncpu|cut -d" " -f2` "$@"? ? ? ? ? ? ;;? ? ? ? *)? ? ? ? ? ? /usr/sbin/schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@"? ? ? ? ? ? ;;? ? esac}
ROM.mka
NOTE:1、参考编译时间:90min(ThinkPad T61 ,3GB RAM?)2、编译出错处理(自己摸索的,非官方)错误1:编译约1个小时后出现的:target Strip: libutils (out/target/product/generic/obj/lib/libutils.so)target Dex: QuickSearchBoxframeworks/base/core/java/android/widget/VideoView.java:46: package com.ti.omap.omap_mm_library does not existimport com.ti.omap.omap_mm_library.OmapMMLibrary;? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^frameworks/base/core/java/android/widget/VideoView.java:62: cannot find symbolsymbol ?: class OmapMMLibrarylocation: class android.widget.VideoView? ? private OmapMMLibrary mOmapMMHandle = null;? ? ? ? ? ? ^frameworks/base/core/java/android/widget/VideoView.java:196: cannot find symbolsymbol ?: class OmapMMLibrarylocation: class android.widget.VideoView? ? ? ? ? ? mOmapMMHandle = new OmapMMLibrary();? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^Note: Some input files use or override a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: Some input files use unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.3 errorsmake: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar] Error 41make: *** Waiting for unfinished jobs....错误分析和处理:看起来是OmapMMLibrary的找不到,后来发现此代码在framework/base/omapmmlib中,修改 build/core/pathmap.mk的FRAMEWORKS_BASE_SUBDIRS,如下
FRAMEWORKS_BASE_SUBDIRS := \$(addsuffix /java, \ ? ?core \ ? ?graphics \ ? ?location \ ? ?media \ ? ?opengl \ ? ?sax \ ? ?telephony \ ? ?wifi \ ? ?vpn \ ? ?keystore \ ? ?voip \ ? ?omapmmlib\ )
错误2:编译即将完成时出现的,此时system.img还未生成Checking API: checkapi-lastChecking API: checkapi-current(unknown): error 13: Class android.app.Profile changed final qualifier(unknown): error 13: Class android.app.ProfileGroup changed final qualifier(unknown): error 24: Method android.app.ProfileManager.getProfile has changed deprecation state(unknown): error 24: Method android.app.ProfileManager.setActiveProfile has changed deprecation state(unknown): error 3: Added class MultiSelectListPreference to package android.preference(unknown): error 4: Added public method android.app.Profile.getProfileGroup(unknown): error 4: Added public method android.app.Profile.getStatusBarIndicator(unknown): error 4: Added public method android.app.Profile.getUuid(unknown): error 4: Added public method android.app.Profile.setStatusBarIndicator(unknown): error 4: Added public method android.app.ProfileGroup.getUuid(unknown): error 4: Added public method android.app.ProfileManager.getProfile(unknown): error 4: Added public method android.app.ProfileManager.profileExists(unknown): error 4: Added public method android.app.ProfileManager.setActiveProfile(unknown): error 4: Added public method android.telephony.TelephonyManager.isDormancyRejected(unknown): error 4: Added public method android.telephony.TelephonyManager.setDormancyRejected(unknown): error 5: Added public field android.Manifest.permission.RAW_AUDIO(unknown): error 9: Removed public method android.app.Profile.getProfileGroup(unknown): error 9: Removed public method android.app.ProfileGroup.getName
******************************You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:? ?1) You can add "@hide" javadoc comments to the methods, etc. listed in the? ? ? errors above.
? ?2) You can update current.xml by executing the following command:? ? ? ? ?make update-api
? ? ? To submit the revised current.xml to the main Android repository,? ? ? you will need approval.******************************
make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] Error 38make: *** Waiting for unfinished jobs....htmlDir not a directory: out/target/common/docs/genDroidDoc took 252 sec. to write docs to out/target/common/docs/doc-comment-check
错误处理:执行一次?make update-api 后编译可以顺利完成。
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-cyanogenCopy the?ramdisk.img?system.img?and?userdata.img?file from?~/android/system/out/target/product/generic?toYour/Android-SDK/platforms/android-9-cyanogen/images/Run the?Android?AVD Manager and select the second?Android?2.3 target.?
1 楼 youthie 2012-02-14 多谢您,尤其是
“如果下载过程中报某个目录一直出错,则需删除该目录再同步”这句~