eclipse下导入app源代码无法编译import android.webkit.CacheManager;类的问题

来源:互联网 发布:java谁拿了最多奖学金 编辑:程序博客网 时间:2024/06/15 02:02

错误现象:

import android.webkit.CacheManager;


public void clearAppCache() {
// 清除webview缓存
File file = CacheManager.getCacheFileBaseDir();
if (file != null && file.exists() && file.isDirectory()) {
for (File item : file.listFiles()) {
item.delete();
}
file.delete();
}


出现原因是:此类已弃用。 将来的版本中将会删除对HTTP缓存的访问。

This class is deprecated.
Access to the HTTP cache will be removed in a future release.


参考API:http://www.android-doc.com/reference/android/webkit/CacheManager.html



解决方案是:

降低项目的编译SDK版本

project.properties 里面 Android版本改到15试试~~




0 0