1

我在Android框架(Android 4.2)的PackageManagerService.java中修改了一些代码。make之后,启动模拟器,报如下错误:

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)

如果我清理然后再次制作完整的项目,它可以正常工作。但是再修改一次会报同样的错误。由于再次进行完整构建将持续很长时间,因此我更喜欢其他解决方案。

我注意到 DexPrepare.cpp 中的代码:

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

如果我删除这些代码行,它将起作用。我以前在Android 2.3上工作,在Android 2.3(Gingerbread)中还有签名检查,但是在修改Gingerbread的框架后,它永远不会报告这样的错误。这是为什么?

4

2 回答 2

1

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

于 2013-04-21T03:17:59.793 回答
0

我认为在自定义 ROM 的构建和闪存期间,您不会清理数据和缓存图像。在这种情况下,在这些图像中odexed core.jar存储旧版本,并且在启动过程中,Android 会尝试将新版本与旧版本进行比较。所以当你做了一些修改时,签名是不同的。

于 2013-03-11T13:01:38.870 回答