活力37846
在线时间12166 小时
阅读权限200
管理员
自由的灵魂
- 积分
- 100458
- 主题
- 5590
- 回帖
- 26310
- 注册时间
- 2003-4-10
- 最后登录
- 2024-11-21
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
安卓智能手机刷机时,经常用到 Recovery,里面一个选项是【wipe dalvik cache】, 翻译为【清除 dalvik 缓存】。刷机时究竟有没有必要清除 dalvik 缓存呢?让我们看看下面转引的两段话吧:
CM Wiki上的解释:
The dalvik-cache directory holds all of the pre-compiled .dex files created from the .apk and .jar files in your phone. These files are generated whenever the Dalvik virtual machine detects that the existing .dex files were made with an older version, typically whenever you install/upgrade CM. (This is why first boot of an upgrade takes longer than a normal boot.)
Deleting the dalvik-cache directory can fix some bugs like apps starting and crashing (not necessarily force closing). However, there is no reason to 'clear the dalvik-cache' like you would clear the browser cache. Once generated these files are static and only added to if you install new apps.
IsaacZ手译:
Dalvik缓存目录内包含了手机内所有.apk和.jar文件产生的的.DEX预编译文件。每当Dalvik虚拟机检测到现存的.dex文件来自一个旧的软件版本时,就会生成新的.dex文件——作为一个典型例子,每当你安装或升级CM时,如上情况必会发生。(这就是为什么升级后第一次启动要比正常开机花更长的时间)。
删除Dalvik缓存目录可以修复一些错误,例如程序启动后崩溃(未必一定表现为“强制关闭或等待”/FC)。不过我们完全没有理由像对待浏览器缓存那样去“清除Dalvik缓存”,因为这些文件一旦生成,就以静态文件形式存在,只有在安装新的程序时才会添加新的进去。
Cyanogen在xda的回答:
When Android starts up, the DalvikVM looks thru all of your applications (.apk files) and frameworks, and builds a tree of dependencies. It uses this dependency tree to optimize the bytecode for every application and stores it in the Dalvik cache. The applications are then run using the optimized bytecode. This is why when you install a new ROM, sometimes it takes a very long time to boot for the first time. Any time an application (or framework library) changes, it's reoptimized and the cache is updated.
当Android系统启动时,Dalvik虚拟机会遍历所有的应用程序(.apk文件)和框架,并建立一个依存关系树。它用这个依存关系树来优化每个应用程序的字节码,并将之存储在Dalvik缓存中。应用程序运行时,将会用到这些优化过的字节码。这就是当你新装一个ROM后第一次启动会耗时很长的原因。每当一个应用程序或者框架库产生变化,都会被优化,Dalvik缓存也将随之更新。 |
|