android缓存清理无效,Android开发之清理系统缓存错误
最近在做清理系统缓存功能时,用到以下方法PackageManagerpm=context.getPackageManager();MethodlocalMethod=pm.getClass().getMethod("freeStorageAndNotify",Long.TYPE,IPackageDataObserver.class);LonglocalLong=Long.va...
最近在做清理系统缓存功能时,用到以下方法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)