简体   繁体   中英

Mismatch Dep Signature after Modifications on Android framework

I modified some code in PackageManagerService.java in Android framework(Android 4.2). After a make, and start the emulator, it report the following error:

10-05 08:20:34.213: I/dalvikvm(575): DexOpt: mismatch dep signature for '/system/framework/core.odex'
10-05 08:20:34.213: E/dalvikvm(575): /system/app/PackageInstaller.apk odex has stale dependencies
10-05 08:20:34.213: E/dalvikvm(575): odex source not available -- failing
10-05 08:20:34.223: W/PackageManager(575): StaleDexCacheError when reading apk: /system/app/PackageInstaller.apk
10-05 08:20:34.223: W/PackageManager(575): dalvik.system.StaleDexCacheError: /system/app/PackageInstaller.apk
10-05 08:20:34.223: W/PackageManager(575):  at dalvik.system.DexFile.isDexOptNeeded(Native Method)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.pm.PackageManagerService.performDexOptLI(PackageManagerService.java:3375)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.pm.PackageManagerService.scanPackageLI(PackageManagerService.java:3960)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.pm.PackageManagerService.scanPackageLI(PackageManagerService.java:3238)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.pm.PackageManagerService.scanDirLI(PackageManagerService.java:3017)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:1058)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:837)
10-05 08:20:34.223: W/PackageManager(575):  at com.android.server.ServerThread.run(SystemServer.java:177)

If I clean and then make the full project again, it works ok. But it will report the same error after another modification. Since making a full build again will last a very long time, I prefer other solution.

I noticed the code in DexPrepare.cpp:

if (memcmp(signature, ptr, kSHA1DigestLen) != 0) {  
    LOGI("DexOpt: mismatch dep signature for '%s'", cacheFileName);  
    goto bail;  
}  

If I remove these lines of code, it will work. I used to work on Android 2.3, and there are still a signature checking in Android 2.3(Gingerbread), but after modifications on Gingerbread's framework, it will never report such errors. Why is that?

我终于通过明确运行make droidcore解决了这个问题。

I think that during the build and flash of your custom ROM you do not clean data and cache images. In this case in these images the old version of odexed core.jar is stored and during the boot Android tries to compare the new version with the old one. And so as you have done some modifications the signatures are different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM