Android 4.0 framework源码修改编译,模拟器运行不起来——解决

最近在看frameworks里的源码,手痒了,便想改改看看效果,没想到改完后,模拟器却运行不起来了。

        首先声明,我是用的android 4.0.3 ICS的源码,编译好后,利用编译好的镜像启动的模拟器,以前修改过里面的Launcher,将生成的Launcher.apk和Launcher.odex  push后是成功的。

现在我在

frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java

frameworks/base/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java

中加了一点log,其实就是解锁时相应的输出坐标等信息,

试了两种方法:

1. make framework  
  make snod

2.  在framework/base中mm
  adb push framework.jar 和 framework.odex 到 system/framework/

结果都是在启动模拟器时,在开机显示 android字样时进不去了,ddms中不停的打印如下信息:

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)

后来根据高手的提示,去看 build/core/main.mk,发现里面有个droidcore命令,

尝试使用make droidcore编译后,模拟器成功运行,并打印出修改的log,后来仔细分析droidcore:

755 .PHONY: droidcore

756 droidcore: files \
757     systemimage \
758     $(INSTALLED_BOOTIMAGE_TARGET) \
759     $(INSTALLED_RECOVERYIMAGE_TARGET) \
760     $(INSTALLED_USERDATAIMAGE_TARGET) \
761     $(INSTALLED_FILES_FILE)
发现一开始是执行systemimage,于是我又尝试用make systemimage来编译:
修改framework中源码,在framework/base 中mm,退至源码根目录,make systemimage后,启动模拟器,修改效果成功显示。
Ps:
1.貌似执行make snod(systemimage no dependence)不行,看来要编上dependence才行。
2.在make systemimage 之后一定要关闭模拟器重开才行,执行adb shell stop,adb shell start也不行。
就是时间比较长,编一下要10分钟左右。

发布了190 篇原创文章 · 获赞 4 · 访问量 37万+
展开阅读全文

安卓源码编译模拟器启动不起来

05-20

安卓源码中在libcore,以及frameworks , external目录下添加了一些log信息 编译后的system.img镜像, 模拟器运行不起来 log不断打印如下信息: D/AndroidRuntime( 855): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<< D/AndroidRuntime( 855): CheckJNI is ON I/SamplingProfilerIntegration( 855): Profiling disabled. I/dalvikvm( 855): threadid=1: stack overflow on call to Ljava/util/GregorianCalendar;.fullFieldsCalc:VJII I/dalvikvm( 855): method requires 100+20+28=148 bytes, fp is 0x4615f380 (128 left) I/dalvikvm( 855): expanding stack end (0x4615f300 to 0x4615f000) I/dalvikvm( 855): Shrank stack (to 0x4615f300, curFrame is 0x4615f670) D/AndroidRuntime( 855): Shutting down VM W/dalvikvm( 855): threadid=1: thread exiting with uncaught exception (group=0x409961f8) I/ServiceManager( 30): service 'media.audio_flinger' died I/ServiceManager( 30): service 'media.player' died I/ServiceManager( 30): service 'media.camera' died I/ServiceManager( 30): service 'media.audio_policy' died I/Netd ( 860): Netd 1.0 starting E/Netd ( 860): Unable to bind netlink socket: No such file or directory E/Netd ( 860): Unable to open quota2 logging socket I/ ( 859): ServiceManager: 0xf958 I/AudioFlinger( 859): Loaded primary audio interface from LEGACY Audio HW HAL (audio) I/AudioFlinger( 859): Using 'LEGACY Audio HW HAL' (audio.primary) as the primary audio interface D/AudioHardwareInterface( 859): setMode(NORMAL) I/CameraService( 859): CameraService started (pid=859) D/EmulatedCamera_QemuClient( 859): Emulated camera list: D/EmulatedCamera_FakeCamera( 859): Initialize: Fake camera is facing back V/EmulatedCamera_Factory( 859): 1 cameras are being emulated. Fake camera ID is 0 I/AudioFlinger( 859): AudioFlinger's thread 0x10f50 ready to run W/AudioFlinger( 859): Thread AudioOut_1 cannot connect to the power manager service I/AudioPolicyService( 859): Loaded audio policy from LEGACY Audio Policy HAL (audio_policy) 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览