背景简介:最近在研究 Jacoco,参考了易寒在社区的文章传送门,直接使用到自己项目上出现了下面的问题;
每次使用 adb(adb shell am instrument xxx/xxx) 命令后,都卡在调用的 activity 或者 app 直接闪退;
- 导入的 java 文件,以及各项配置我已经检查了几遍没有问题;
- 第一款 app,使用 adb 调起 app 后,app 直接崩溃;查看 logcat,报错代码如下:
restore file fail. java.io.FileNotFoundException: /storage/emulated/0/Android/data/xxx.xxx.xxx/files/awcn_strategy/channel: open failed: EISDIR (Is a directory) at libcore.io.IoBridge.open(IoBridge.java:444) at java.io.FileInputStream.<init>(FileInputStream.java:78) at anet.channel.util.h.a(Taobao:87) at anet.channel.strategy.l.b(Taobao:116) at anet.channel.strategy.StrategyInfoHolder.a(Taobao:139) at anet.channel.strategy.StrategyInfoHolder.a(Taobao:31) at anet.channel.strategy.f.run(Taobao:120) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: libcore.io.ErrnoException: open failed: EISDIR (Is a directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
- 看到报错我觉得是 app 的问题.所以我又尝试自己创建了一个 helloworld 最为简单的工程,成功调起来了,但是
coverage.ec
文件没有任何记录 0 字节;- 于是我尝试使用第 3 款 app,卡在调用的 activity,logcat 报错如下:
Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
可以看到找不到这个 class,于是查看源代码发现boolean hasOverlappingRendering() { final Drawable background = mView.getBackground(); if (Build.VERSION.SDK_INT >= 21 && background instanceof android.graphics.drawable.RippleDrawable) { // RippleDrawable has an issue on L+ when used with an alpha animation. // This workaround should be disabled when the platform bug is fixed. See b/27715789 return false; } return true; } }
,可能跟 SDK 版本有关系,但是我看我测试手机版本为4.4.2(19)
不应该走这段代码才对啊;- 从此后懵逼了,是手机原因?还是我 Jacoco 使用的问题?还是 app 的原因?