gpt4 book ai didi

java - Robolectric 未找到包含 org.robolectric.ShadowsAdapter 的阴影模块

转载 作者:行者123 更新时间:2023-12-01 09:19:13 29 4
gpt4 key购买 nike

我按照官方教程将 robolectric 添加到我现有的 Android 应用程序中。但是当我尝试运行一个简单的测试时,我收到了一个错误:

java.lang.RuntimeException: No shadows modules found containing a org.robolectric.ShadowsAdapter
at org.robolectric.Robolectric.instantiateShadowsAdapter(Robolectric.java:223)
at org.robolectric.Robolectric.getShadowsAdapter(Robolectric.java:48)
at org.robolectric.internal.ParallelUniverse.<init>(ParallelUniverse.java:39)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
......

这是我的测试:

@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 23)
public class ExampleUnitTest {
@Test
public void test() throws Exception {
}
}

build.gradle 文件:

dependencies {
....
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:3.1.3"
}

最佳答案

尝试更改:

testCompile“org.robolectric:robolectric:3.1.3”

testCompile“org.robolectric:robolectric:3.1.2”

关于java - Robolectric 未找到包含 org.robolectric.ShadowsAdapter 的阴影模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40280818/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com