Roboelectric 3编译错误

时间:2016-06-30 15:01:22

标签: android maven robolectric

在我的应用中,我更新了Roboelectric 2Roboelectric 3
在下一个代码:

final Dialog dialog = ShadowDialog.getLatestDialog();
final ShadowDialog shadowDialog = Shadows.shadowOf(dialog);
Assert.assertNotNull(shadowDialog);

我有一个奇怪的并发症错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (test-compile) on project tunneling-agent-lib: Compilation failure: Compilation failure:
[ERROR] final ShadowDialog shadowDialog = Shadows.shadowOf(dialog);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The type android.net.ConnectivityManager$NetworkCallback cannot be resolved. It is indirectly referenced from required .class files

在此之前一切正常(使用maven构建):

<dependency>
    <groupId>org.robolectric</groupId>
    <artifactId>robolectric</artifactId>
    <version>3.0</version>
    <scope>test</scope>
</dependency>

可能导致什么原因?

1 个答案:

答案 0 :(得分:0)

您是否可以尝试将Android / Sdk / platforms / android-23 / optional中的org.apache.http.legacy.jar添加到您的maven依赖项中?