Android开发之清理系统缓存错误
时间:2014-05-25 21:02:21
收藏:0
阅读:387
最近在做清理系统缓存功能时,用到以下方法
PackageManager pm = context.getPackageManager();
Method localMethod = pm.getClass().getMethod("freeStorageAndNotify", Long.TYPE, IPackageDataObserver.class);
Long localLong = Long.valueOf(getEnvironmentSize() - 1L);
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = localLong;
localMethod.invoke(pm, localLong, new IPackageDataObserver.Stub() {
public void onRemoveCompleted(String packageName, boolean succeeded) throws RemoteException {
}
});在调试状态能正常运行,但是正式打包编译就遇到一个错误,日志提示NoSuchMethodException(
freeStorageAndNotify
本文出自 “高山流水遇知音” 博客,请务必保留此出处http://dhhuanghui.blog.51cto.com/7092892/1416798
评论(0)