1

私はアンドロイドアプリのインストルメンテーションテストを開発する必要があります。また、エスプレッソにアクティビティがアイドルであることを伝えるために私のアプリケーションにインターフェイスIdlingResourceを実装する必要があります。私は、エスプレッソの依存関係を2回追加する必要があり、通常のコンパイルに1つ、テストコンパイルで1、その次のようになります。エスプレッソの依存関係を通常のテストコンパイルに追加

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    [...] 
    compile('com.android.support.test.espresso:espresso-core:2.2.2') { 
     exclude module: 'support-annotations' 
    } 
    androidTestCompile('com.android.support.test:runner:0.5') { 
     exclude module: 'support-annotations' 
    } 
    androidTestCompile('com.android.support.test:rules:0.5') { 
     exclude module: 'support-annotations' 
    } 
    // The following lib is already imported in a standard way, but needs to be imported again 
    // in the test environment. 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') { 
     exclude module: 'support-annotations' 
    } 
    androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2.2') { 
     exclude module: 'support-annotations' 
    } 
    [...] 
} 

しかし、アプリの通常のコンパイルを行うと、動作しません:

Error:Execution failed for task ':app:processDebugAndroidTestResources'. 
> java.io.FileNotFoundException: [...]/app/build/intermediates/symbols/androidTest/debug/R.txt (No such file or directory) 

何か間違っていますか?

答えて

2

あなたbuild.gradleから削除:

compile('com.android.support.test.espresso:espresso-core:2.2.2') { 
     exclude module: 'support-annotations' 
} 

thisを参照してください、あなたは全体ではなく、エスプレッソコアLIBのcompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'を追加する必要があります。

関連する問題