http://www.mecil9.com/archives/catalog/40/default.aspx
我以前在一个controller中引用一个naviController总是要通过delegate来取得:
[[[[UIApplication sharedApplication] delegate ] naviController] pushViewController: printView animated:TRUE];
今天在源代码中发现有注释是这样的:
@property(nonatomic,readonly,retain) UINavigationController *navigationController; // If this view controller has been pushed onto a navigation controller, return it.
发现在控制器中就直接有这个对象属性了:
[self.navigationController pushViewController: printView animated:TRUE];
[self.navigationController presentModalViewController:self.worldCitiesListNavigationController animated:YES];
不知道的东西太多了。
在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.
-
1 Prepare the Build Environment
- 1.1 Install the ADB
- 1.2 Install the Build Packages
- 1.3 Create the Directories
- 1.4 Install the Repository
- 2 Download RomManager
-
3 Building CyanogenMod
- 3.1 Check for updates
- 3.2 Configure Build
- 3.3 Compile
- 4 Install
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 schedtoolsNOTE:
FOR OPENSUSE : bison flex gperf schedtool squashfs libesd-devel build libSDL-devel gcc-c++ java-1_6_0-sun java-1_6_0-sun-devel
For 64-bit only systems:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilibNote: 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 DirectoriesYou will need to set up some directories in your build environment.
To create them:
mkdir -p ~/bin mkdir -p ~/android/system Install the RepositoryEnter the following to download make executable the "repo" binary:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repoNOTE: 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 gingerbread repo sync -j16NOTE: 1、完整下载约5G多,下载过程不能断网; 2、实际表明,使用http连接方式获取代码更佳; 3、如果下载过程断链出错退出,或者手动kill过python进程,在执行sync之前需要删除临时文件: find .repo/ -name tmp* -exec rm {} \; 4、如果下载完成,长时间等待下面提示时; Fetching projects: 98% (208/211) 则需要kill掉python进程,去掉 -j16 参数再次同步 repo sync 5、如果下载过程中报某个目录一直出错,则需删除该目录再同步 6、如果想少下载一些文件,则可以不下载针对具体设备的代码(可以减少下载2G左右的内容),方法如下: a. repo init 执行完毕后,编辑 .repo/manifest.xml 文件,注释掉device相关的projiect,如下
<project path="device/advent/vega" name="CyanogenMod/android_device_advent_vega" /> <project path="device/common" name="CyanogenMod/android_device_common" /> <project path="device/zte/blade" name="CyanogenMod/android_device_zte_blade" />
……
<project path="device/zte/v9" name="CyanogenMod/android_device_zte_v9" />-->
b. repo sync 完成后,编辑 vendor/cyanogen/products/AndroidProducts.mk 文件,只保留下面内容 PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/cyanogen_generic.mk
Download ROM Manager which is needed by the build:
cd ~/android/system/vendor/cyanogen/ ./get-rommanager Building CyanogenMod Check for updatesFirst, check for updates in the source:
cd ~/android/system/ repo sync Configure BuildNow, your environment must be configured to build specifically for the Android Emulator. To set up your build environment:
. build/envsetup.sh lunch cyanogen_generic-engNOTE: 1、新建shell进入工作目录之后都需要执行上述命令 2、如果想彻底重新编译,需执行 make clean 3、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 }
Compile
Next, we will build the actual ROM.
mkaNOTE: 1、参考编译时间:90min(ThinkPad T61 ,3GB RAM ) 2、编译出错处理(自己摸索的,非官方) 错误1:编译约1个小时后出现的: target Strip: libutils (out/target/product/generic/obj/lib/libutils.so) target Dex: QuickSearchBox frameworks/base/core/java/android/widget/VideoView.java:46: package com.ti.omap.omap_mm_library does not exist import com.ti.omap.omap_mm_library.OmapMMLibrary; ^ frameworks/base/core/java/android/widget/VideoView.java:62: cannot find symbol symbol : class OmapMMLibrary location: class android.widget.VideoView private OmapMMLibrary mOmapMMHandle = null; ^ frameworks/base/core/java/android/widget/VideoView.java:196: cannot find symbol symbol : class OmapMMLibrary location: 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 errors make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar] Error 41 make: *** 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-last Checking 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 38 make: *** Waiting for unfinished jobs.... htmlDir not a directory: out/target/common/docs/gen DroidDoc took 252 sec. to write docs to out/target/common/docs/doc-comment-check
错误处理:执行一次 make update-api 后编译可以顺利完成。
Install
“如果下载过程中报某个目录一直出错,则需删除该目录再同步”这句~