Зависимости от эспрессо добавлены в обычную и тестовую компиляции.

Мне нужно разработать инструментальный тест для моего приложения для Android, а также мне нужно реализовать интерфейс IdlingResource для моего приложения, чтобы сообщить Espresso, что активность простаивает; поэтому я должен добавить зависимости Espresso два раза, один в обычной компиляции и один в тестовой компиляции, выглядит так:

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)

Я делаю что-то неправильно?


person svprdga    schedule 05.12.2016    source источник


Ответы (1)


Удалить???????? из build.gradle:

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

См. это. , Вам нужно добавить compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2' вместо всей библиотеки Espresso-core.

person vk.4884    schedule 13.01.2017