0

Spoon を使用してテストを実行しようとしています。

そこで見つけたセットアップガイドによると: 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()
    }
}

2番目:アプリパッケージbuild.gradleに追加しました:

apply plugin: 'spoon'

そして依存関係:

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

そして、デバッグ ビルドを使用することを指定しました。

spoon {
    debug true
}

3 番目: ターミナルに移動し、ディレクトリをプロジェクト ルートに設定して呼び出します

./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: [com.squareup.spoon.SpoonInstrumentationInfo@7baf516e[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 com.squareup.spoon.DeviceDetails@22444900[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;
4

2 に答える 2

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-plugin 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'
于 2015-10-21T11:03:01.767 に答える
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

于 2015-10-20T15:40:45.673 に答える