Android 4.0 framework modify, emulator can not start

本文介绍了在修改Android ICS框架源代码并尝试在模拟器上运行时遇到的问题及解决方案。通过调整构建命令,如使用make droidcore或make systemimage,成功解决了模拟器卡在启动画面的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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' died
07-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'.

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值