Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

部分机型可能无法创建缓存目录,抛出的异常导致程序crash,能否对这一场景做处理 #38

Open
clouse opened this issue Jan 13, 2017 · 9 comments

Comments

@clouse
Copy link

clouse commented Jan 13, 2017

private ACache(File cacheDir, long max_size, int max_count) {
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
throw new RuntimeException("can't make dirs in "
+ cacheDir.getAbsolutePath());
}
}
主要是一段代码

@yanbober
Copy link

@clouse 首先检查你读写权限吧

@ihainan
Copy link

ihainan commented Jun 1, 2017

@clouse 我也遇到了这个问题,你最后是怎么解决的呢?

@ghost
Copy link

ghost commented Jul 4, 2017

@clouse @ihainan 请问你们最后是怎么解决的呢?我现在遇到这个问题了

@ihainan
Copy link

ihainan commented Jul 4, 2017

@TonyJason 我对 ACache 稍做了修改,尝试了不同的缓存目录,直到成功为止。我是个业余开发者,手头没能够复现的机型,不确定是不是这个修改起作用了,但后来的确没在 Bugly 后台看到该异常了:https://github.com/ihainan/BITUnion-for-Android/blob/master/app/src/main/java/me/ihainan/bu/app/utils/ACache.java

@ghost
Copy link

ghost commented Jul 4, 2017

@ihainan 谢谢,我这边也是部分机型会这样。我用的也是Bugly ,我先尝试按照你的方法修改,看看情况是否会好些。

@ihainan
Copy link

ihainan commented Jul 13, 2017

@TonyJason 你这测试的怎样,情况是否有所好转呢?

@ghost
Copy link

ghost commented Jul 13, 2017

@ihainan 项目已经上线了,暂时还没有报哪个错误,我不知道是不是真生效了还是因为什么原因,我们APP只是少部分机型会这样,所以得再观察一段时间看看。非常感谢。

@yaya2212
Copy link

@TonyJason 按照@ihainan 的修改方式后续监控效果如何?

@ghost
Copy link

ghost commented Aug 23, 2017

@yaya2212 目前好像没有发现报这个错误了,不过发现了另外一个问题,getAsBinary(String key) 这个方法居然会报OOM, 不过目前只在华为P8上出现了,其他机型暂时没,不知道是啥原因,貌似是AsimpleCache本身的问题,再次感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants