Android(安卓)4.0 framework modify, emulator can not start
Original edition
Today, I receive an email from USA, which ask me if I have solved this problem or not. I reply him and attached with my blog's link. But I'm not sure whether he can understand my original blog although we have powerful google. So I decide to write my first english blog. Just do some translation . :P
Recently, I'm reading the source code of framework in Android ICS, and try do some modify on it.
I build the ICS source code successfully and run an emulator from the built system.img, then I add some logs in below two files:
frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java
frameworks/base/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
What I did is just output the location of lock when unlock the screen,
then I try two ways to build it:
1.make framework
make snod
2.mm in framework/base
adb push framework.jar and framework.odex to system/frameowrk/
Both these two ways lead to this problem:
when the emulator start, it blocks in "android" logo, and the DDMS keeps outputting:
07-30 06:50:52.762: I/ServiceManager(30): service 'media.audio_policy' died07-30 06:50:52.762: I/ServiceManager(30): service 'media.audio_flinger' died
07-30 06:50:52.762: I/ServiceManager(30): service 'media.player' died
07-30 06:50:52.762: I/ServiceManager(30): service 'media.camera' died
07-30 06:50:52.822: I/Netd(383): Netd 1.0 starting
07-30 06:50:52.842: E/Netd(383): Unable to bind netlink socket: No such file or directory
07-30 06:50:52.842: E/Netd(383): Unable to open quota2 logging socket
07-30 06:50:53.253: I/(381): ServiceManager: 0xf958
07-30 06:50:53.253: I/AudioFlinger(381): Loaded primary audio interface from LEGACY Audio HW HAL (audio)
07-30 06:50:53.253: I/AudioFlinger(381): Using 'LEGACY Audio HW HAL' (audio.primary) as the primary audio interface
07-30 06:50:53.253: D/AudioHardwareInterface(381): setMode(NORMAL)
07-30 06:50:53.253: I/CameraService(381): CameraService started (pid=381)
07-30 06:50:53.262: D/EmulatedCamera_QemuClient(381): Emulated camera list:
07-30 06:50:53.262: D/EmulatedCamera_FakeCamera(381): Initialize: Fake camera is facing back
07-30 06:50:53.262: V/EmulatedCamera_Factory(381): 1 cameras are being emulated. Fake camera ID is 0
07-30 06:50:53.272: I/AudioFlinger(381): AudioFlinger's thread 0x10fb0 ready to run
07-30 06:50:53.272: W/AudioFlinger(381): Thread AudioOut_1 cannot connect to the power manager service
07-30 06:50:53.272: I/AudioPolicyService(381): Loaded audio policy from LEGACY Audio Policy HAL (audio_policy)
07-30 06:50:56.022: D/AndroidRuntime(393): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
07-30 06:50:56.022: D/AndroidRuntime(393): CheckJNI is ON
07-30 06:50:56.042: I/dalvikvm(393): DexOpt: mismatch dep signature for '/system/framework/framework.odex'
07-30 06:50:56.042: E/dalvikvm(393): /system/framework/android.policy.jar odex has stale dependencies
07-30 06:50:56.042: I/dalvikvm(393): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
07-30 06:50:56.042: D/dalvikvm(393): Unable to process classpath element '/system/framework/android.policy.jar'
07-30 06:50:56.042: I/dalvikvm(393): DexOpt: Some deps went away
07-30 06:50:56.042: E/dalvikvm(393): /system/framework/services.jar odex has stale dependencies
07-30 06:50:56.042: I/dalvikvm(393): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
07-30 06:50:56.042: D/dalvikvm(393): Unable to process classpath element '/system/framework/services.jar'
07-30 06:50:56.042: I/dalvikvm(393): DexOpt: mismatch dep signature for '/system/framework/framework.odex'
07-30 06:50:56.042: E/dalvikvm(393): /system/framework/apache-xml.jar odex has stale dependencies
07-30 06:50:56.042: I/dalvikvm(393): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
07-30 06:50:56.042: D/dalvikvm(393): Unable to process classpath element '/system/framework/apache-xml.jar'
07-30 06:50:56.042: I/dalvikvm(393): DexOpt: mismatch dep signature for '/system/framework/framework.odex'
07-30 06:50:56.042: E/dalvikvm(393): /system/framework/filterfw.jar odex has stale dependencies
07-30 06:50:56.042: I/dalvikvm(393): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
07-30 06:50:56.042: D/dalvikvm(393): Unable to process classpath element '/system/framework/filterfw.jar'
07-30 06:50:56.682: E/JNIHelp(393): Native registration unable to find class 'com/android/server/Watchdog', aborting
07-30 06:50:56.682: A/libc(393): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
Then according to some guy's suggestion, I read the 'build/core/main.mk'.
I find that there is a 'droidcore' cmd in it, I try 'make droidcore', it works, the emulator can start successfully.
Reading the 'droidcore' cmd more carefully:
755 .PHONY: droidcore
756 droidcore: files \757 systemimage \
758 $(INSTALLED_BOOTIMAGE_TARGET) \
759 $(INSTALLED_RECOVERYIMAGE_TARGET) \
760 $(INSTALLED_USERDATAIMAGE_TARGET) \
761 $(INSTALLED_FILES_FILE)
It seems that'make droidcore' cmd means 'make systemimage' and so on.
So I try run 'make systemimage', it works fine too, and faster than 'makedroidcore'.
Solution:
1. After modify the source code in framework/base, do 'mm' in framework/base
2. Navigate to the root dir of ICS, do 'make systemimage'
3. Restart the AVD totally, not just run 'adb shell stop' && 'adb shell start'. (These cmds maybe not work).
PS:
'make snod' means make systemimage no dependence, it seems the dependence is needed, so we should use 'make systemimage' instead of 'make snod'.
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer