Java org.fest.reflect.exception.ReflectionError:找不到方法'$$机器人$getData';在com.android.myActivity中

Java org.fest.reflect.exception.ReflectionError:找不到方法'$$机器人$getData';在com.android.myActivity中,java,android,eclipse,ant,robolectric,Java,Android,Eclipse,Ant,Robolectric,我正在使用robolectric进行android自动化测试,并使用eclipse进行ant构建,当时我正在尝试生成给定的代码行 Robolectric.buildActivity(MyActivity.class).create().visible().get(); throwing org.fest.reflect.exception.ReflectionError: Unable to find method '$$robo$getData error 我正在我的lib文件夹中使用以下

我正在使用robolectric进行android自动化测试,并使用eclipse进行ant构建,当时我正在尝试生成给定的代码行

 Robolectric.buildActivity(MyActivity.class).create().visible().get(); throwing org.fest.reflect.exception.ReflectionError: Unable to find method '$$robo$getData error
我正在我的lib文件夹中使用以下库

Used library 
fest-android-1.0.8.jar
fest-assert-core-2.0M10.jar
fest-util-1.1.6.jar
hamcrest-core-1.3.jar
junit-4.11-sources.jar
junit-4.11.jar
mockito-core-1.9.5.jar
robolectric-2.3-jar-with-dependencies.jar
robolectric-with-dependencies.jar(Used for creating a test runner class  for ant and eclipse build)
在删除roblectric-with-dependencies.jar之后,我得到了

  [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository sonatype at https://oss.sonatype.
org/content/groups/public/
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository sonatype (https://oss.sonatype.org/content/g
roups/public/): Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository central at http://repo1.maven.org
/maven2
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository sonatype at https://oss.sonatype.
org/content/groups/public/
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository sonatype (https://oss.sonatype.org/content/g
roups/public/): Error transferring file: oss.sonatype.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository central at http://repo1.maven.org
/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] Tests run: 9, Failures: 0, Errors: 9, Time elapsed: 0.087 sec
    [junit] Test com.pivotallabs.tracker.SignInDialogTest FAILED
    [junit] Running com.pivotallabs.tracker.TrackerAuthenticationRequestTest
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository sonatype at https://oss.sonatype.
org/content/groups/public/
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository sonatype (https://oss.sonatype.org/content/g
roups/public/): Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository central at http://repo1.maven.org
/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository sonatype at https://oss.sonatype.
org/content/groups/public/
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository sonatype (https://oss.sonatype.org/content/g
roups/public/): Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository central at http://repo1.maven.org
/maven2
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 0.022 sec
    [junit] Test com.pivotallabs.tracker.TrackerAuthenticationRequestTest FAILED

    [junit] Running com.pivotallabs.util.StringsTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.002 sec
    [junit] Running com.pivotallabs.views.LoadingTextViewTest
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository sonatype at https://oss.sonatype.
org/content/groups/public/
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository sonatype (https://oss.sonatype.org/content/g
roups/public/): Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository central at http://repo1.maven.org
/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository sonatype at https://oss.sonatype.
org/content/groups/public/
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository sonatype at https://oss.sonatype.org/content/groups/public/
    [junit] Error transferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository sonatype (https://oss.sonatype.org/content/groups/public/): Error tran
sferring file: oss.sonatype.org
    [junit] Error transferring file: oss.sonatype.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository sonatype (https://oss.sonatype.org/content/g
roups/public/): Error transferring file: oss.sonatype.org
    [junit] Downloading: org/json/json/20080701/json-20080701.jar from repositor
y central at http://repo1.maven.org/maven2
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository sonatype (https://oss.sonatype.org/content/groups/public/)
: Error transferring file: oss.sonatype.org
    [junit] Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/androi
d-all-4.3_r2-robolectric-0.jar from repository central at http://repo1.maven.org
/maven2
    [junit] Error transferring file: repo1.maven.org
    [junit] Downloading: org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar from
 repository central at http://repo1.maven.org/maven2
    [junit] [WARNING] Unable to get resource 'org.json:json:jar:20080701' from r
epository central (http://repo1.maven.org/maven2): Error transferring file: repo
1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] Error transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.robolectric:android-all:jar:4.
3_r2-robolectric-0' from repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
    [junit] [WARNING] Unable to get resource 'org.ccil.cowan.tagsoup:tagsoup:jar
:1.2' from repository central (http://repo1.maven.org/maven2): Error transferrin
g file: repo1.maven.org
    [junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 0.017 sec
    [junit] Test com.pivotallabs.views.LoadingTextViewTest FAILED

BUILD FAILED
D:\Robolectric(SetUp)\New folder\robolectric-ant-sample-master\custom_rules.xml:
58: Unit test(s) failed.  See reports!

Total time: 9 seconds

它似乎试图从maven repo下载一些东西,但我没有使用它。

有robolectric-with-dependencies.jar版本2.3吗?是的,我正在使用我在used lib部分中提到的robolectric-2.3-jar-with-dependencies.jar。为什么有两次?因为我使用的是该jar中的ruuner类……有什么问题吗?它可以使用同一个库的两个版本时会导致冲突,因为有些类可以从一个jar加载,有些则可以从另一个jar加载。你应该避免这种情况。