0

我在运行 Robolectric示例应用程序 时遇到问题

当我开始“蚂蚁清洁测试”时,它给了我这样的错误。我该如何解决?谢谢。

-compile:
    [javac] Compiling 37 source files to D:\Builds\RobolectricSample-master\bin\classes
    [javac] Note: D:\Builds\RobolectricSample-master\src\main\java\com\pivotallabs\api\ApiGateway.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

compile.tests:
    [mkdir] Created dir: D:\Builds\RobolectricSample-master\bin\testClasses
    [javac] Compiling 70 source files to D:\Builds\RobolectricSample-master\bin\testClasses
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\injected\TestApplication.java:4: error: cannot find symbol
    [javac] import org.robolectric.TestLifecycleApplication;
    [javac]                       ^
    [javac]   symbol:   class TestLifecycleApplication
    [javac]   location: package org.robolectric
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\injected\TestApplication.java:10: error: cannot find symbol
    [javac] public class TestApplication extends com.pivotallabs.injected.Application implements TestLifecycleApplication {
    [javac]                                                                                      ^
    [javac]   symbol: class TestLifecycleApplication
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\HomeActivityTest.java:33: error: cannot find symbol
    [javac]         activity = Robolectric.buildActivity(HomeActivity.class).create().get();
    [javac]                               ^
    [javac]   symbol:   method buildActivity(Class<HomeActivity>)
    [javac]   location: class Robolectric
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\NamesActivityTest.java:18: error: cannot find symbol
    [javac]         Activity activity = Robolectric.buildActivity(NamesActivity.class)
    [javac]                                        ^
    [javac]   symbol:   method buildActivity(Class<NamesActivity>)
    [javac]   location: class Robolectric
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\injected\TestApplication.java:19: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\injected\TestApplication.java:23: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] D:\Builds\RobolectricSample-master\src\test\java\com\pivotallabs\injected\TestApplication.java:33: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 7 errors
4

1 回答 1

0

他们的例子看起来太老了。您只需要按照说明操作: http ://robolectric.org/eclipse-quick-start.html

您还需要下载最新版本的库:hamcrest-core-1.3.jar junit-4.11.jar robolectric-2.2-20130802.075524-31-jar-with-dependencies.jar

信息至少在 2013 年 8 月 21 日有效。

于 2013-08-21T09:33:12.707 回答