[英]Robolectric compilation error while using shadowOf method
I am using Robolectric 1.2 in an Andorid 2.3.3 project (API 10) 我在Andorid 2.3.3项目(API 10)中使用Robolectric 1.2
It throws the below compilation error, when using shadowOf method 当使用shadowOf方法时,它会抛出以下编译错误
ShadowView shadowView = Robolectric.shadowOf(view);
error: cannot access ObjectAnimator 错误:无法访问ObjectAnimator
But the error is gone, if I change the android sdk to API 11 and above 但是如果我将android sdk更改为API 11及更高版本,则错误消失了
I'm still having this issue with 2.2. 2.2我仍然遇到这个问题。 I got around this by
我绕过这个
import static org.robolectric.Robolectric.shadowOf_;
...
ShadowView shadowView = Robolectric.shadowOf_(view);
If anyone could provide some insight why this works, that would be awesome! 如果有人能够提供一些有用的信息,那么这将是非常棒的!
After some analysis, found that it is a bug in robolectric. 经过一番分析,发现它是robolectric中的一个bug。
For now, using 2.0-alpha-1 seems to fix the issue. 目前,使用2.0-alpha-1似乎解决了这个问题。
Here is the github issue created for the issue 这是为该问题创建的github问题
https://github.com/pivotal/robolectric/issues/431 https://github.com/pivotal/robolectric/issues/431
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.