Meine Lösung auf Geschmack Konfiguration basiert:
- Split zwei Geschmack:
buildTypes {
release {...}
debug {...}
}
productFlavors {
dev { ... }
autoTest {
minSdkVersion 18 // set to 18 only in this flavor
multiDexEnabled true // if you got dex index overflow error
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
- bewegen Ihre testbezogenen Abhängigkeiten in "autoTestC ompile“
// for test
autoTestCompile 'com.android.support.test:runner:0.5', {
exclude group: 'com.android.support', module: 'support-annotations'
}
autoTestCompile 'com.android.support.test:rules:0.5', {
exclude group: 'com.android.support', module: 'support-annotations'
}
autoTestCompile 'com.android.support.test.espresso:espresso-web:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
autoTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
autoTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
- Run Test
Ich denke, es eine akzeptable Antwort ist. – theblang
@mattblang Ich entschuldige mich dafür, dass ich noch keine Antwort angenommen habe. Am Ende habe ich nur die "minSdkVersion" für die gesamte App geändert und die Antworten noch nicht verifiziert. Ich habe es jedoch nicht vergessen und werde eine Antwort akzeptieren, wenn ich die Antworten selbst testen kann. –