首页 > 代码库 > android编译framework架包运行报错 (转)

android编译framework架包运行报错 (转)

 android编译framework架包运行报错

http://blog.csdn.net/cqupt_chen/article/details/8163632


最近在看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分钟左右。