我有一个地图类的app,在滑动地图的时候造成了程序崩溃,关键是很诡异,没有指出哪一行出错,但就是崩溃了,崩溃日志如下
W/System.err: java.io.FileNotFoundException: /data/user/0/com.ex.shuwu/cache/optlist.ser: open failed: ENOENT (No such file or directory)
W/System.err: at libcore.io.IoBridge.open(IoBridge.java:496)
at java.io.FileInputStream.<init>(FileInputStream.java:159)
at java.io.FileInputStream.<init>(FileInputStream.java:115)
at com.tencent.smtt.net.c.a(TbsJavaCore:63)
at com.tencent.smtt.net.c.c(TbsJavaCore:203)
at com.tencent.smtt.net.NetworkSmttService.preconnectMainResources(TbsJavaCore:141)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8242)
at libcore.io.IoBridge.open(IoBridge.java:482)
... 5 more
这一行日志大概说,我文件读取失败,没有找到该文件,但是我项目里面几乎没有任何文件读取操作。最后查阅了相关资料,发现有两种可能,①layout的布局文件id重名,有可能指向了另外一个xml文件,②Android SDK版本大于等于30,Android SDK版本大于等于30之后,Android读取文件是用URL而不是绝对路径。