2015-10-20 37 views
0

我正在尝试使用勺子运行我的测试。使用勺子的仪器测试设置错误

根据设置指南,我发现在那里:https://github.com/stanfy/spoon-gradle-plugin,我已经对我的项目设置了一些简单的更改。

第一:我已经添加依赖于我的根的build.gradle文件:

buildscript { 
    repositories { 
     jcenter() 
     mavenCentral() 
     (...) 
    } 
    dependencies { 
     (...) 
     classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.0.2' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     mavenCentral() 
    } 
} 

二:在我的应用程序包的build.gradle我说:

apply plugin: 'spoon' 

和依赖:

androidTestCompile 'com.squareup.spoon:spoon-client:1.1.9' 

,并规定我要使用调试版本:

spoon { 
    debug true 
} 

第三:我去端,设置目录到我的项目的根并调用

./gradlew spoon 

我收到此输出和错误。什么可能造成这种情况?

2015-10-20 17:28:12 [SR.runTests] Executing instrumentation suite on 1 device(s). 
2015-10-20 17:28:12 [SR.runTests] Application: com.azimo.sendmoney.debug1 from /Users/F1sherKK/Dev/Azimo-Android/app/build/outputs/apk/app-debug.apk 
2015-10-20 17:28:12 [SR.runTests] Instrumentation: com.azimo.sendmoney.debug1.test from /Users/F1sherKK/Dev/Azimo-Android/app/build/outputs/apk/app-debug-androidTest-unaligned.apk 
2015-10-20 17:28:12 [SR.runTests] [1903cdc7] Starting execution. 
2015-10-20 17:28:12 [SDR.run] InstrumentationInfo: [[email protected][applicationPackage=com.azimo.sendmoney.debug1,instrumentationPackage=com.azimo.sendmoney.debug1.test,testRunnerClass=android.support.test.runner.AndroidJUnitRunner]] 
2015-10-20 17:28:12 [SDR.run] Got realDevice for [1903cdc7] 
2015-10-20 17:28:12 [SDR.run] [1903cdc7] setDeviceDetails [email protected][model=GT-I9505,manufacturer=samsung,version=5.0.1,apiLevel=21,language=en,region=GB,isEmulator=false,avdName=<null>] 
2015-10-20 17:28:12 [SR.runTests] [1903cdc7] Execution done. 
:app:spoonDebugAndroidTest FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:spoonDebugAndroidTest'. 
> com.android.ddmlib.IDevice.installPackage(Ljava/lang/String;Z[Ljava/lang/String;)Ljava/lang/String; 

回答

0

我知道在我的情况下造成的错误。删除:

com.android.ddmlib.IDevice.installPackage(Ljava/lang/String;Z[Ljava/lang/String;‌​)Ljava/lang/String 

我不得不改变我的gradle构建工具。我用之前:

classpath 'com.android.tools.build:gradle:1.4.0-beta2' 

我不得不将其更改为:

classpath 'com.android.tools.build:gradle:1.3.1' 

要重新创建你可以从gradle这个-插件git的示例项目拉动的问题。有:

classpath 'com.android.tools.build:gradle:1.2.2' 

使用。在将它更新到1.4.0之后,它会给出与我一样的错误。我测试了:1.3.1作品,1.4.0beta2-beta6给出了迄今为止的错误。

编辑: 更新亚军和勺客户端后,错误被修复。用途:

androidTestCompile 'com.squareup.spoon:spoon-client:1.2.1' 

classpath 'com.squareup.spoon:spoon-runner:1.2.1' 
0

这解决了这对我来说:

classpath 'com.squareup.spoon:spoon-runner:1.2.0' 
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.3') { 
     exclude module: "guava" 
} 

一些背景: https://github.com/stanfy/spoon-gradle-plugin/issues/74

+0

您好,感谢您的回应。我今天看到了这个线程。试过所有的组合,也试过你的代码。我的输出不会改变,不幸的是没有mather我所做的: com.android.ddmlib.IDevice.installPackage(Ljava/lang/String; Z [Ljava/lang/String;)Ljava/lang/String; 总是在那里。 – F1sher

+0

您添加了:'com.squareup.spoon:spoon-runner:1.2.0'?并做了一个干净的? – ligi

+0

我加了。我没有执行清理,所以我会再试一次。我之前只做过gradle同步。问题是,你为什么要排除番石榴,你还加入吗?像:classpath'com.google.guava:guava:17.0'在什么地方? – F1sher