我刚刚下载了Robolectric样本并试图构建它,但我收到了一个错误:
$ git clone https://github.com/robolectric/robolectric-samples.git
(编辑settings.gradle删除api-16和api-19样本,所以我只构建android-api-21。)
现在我做gradle test
时它在任务'失败':android-api-21:compileTestDebugJava':
:android-api-21:compileTestDebugJava
/tmp/robolectric-samples/android-api-21/src/test/java/com/example/activity/MainActivityTest.java:14: error: cannot access ShadowProvider
import static org.robolectric.Shadows.shadowOf;
^
class file for org.robolectric.util.ShadowProvider not found
/tmp/robolectric-samples/android-api-21/src/test/java/com/example/activity/MainActivityTest.java:23: error: cannot find symbol
final Menu menu = shadowOf(activity).getOptionsMenu();
^
symbol: method shadowOf(Activity)
location: class MainActivityTest
2 errors
:android-api-21:compileTestDebugJava FAILED
我想这可能是3.0-SNAPSHOT构建的暂时问题,还是我做错了什么?
更多信息:
./gradlew --refresh-dependencies test