Я хочу написать автоматические тесты для стороннего приложения с UiAutomater2, я использую этот код для создания своего UiDevice:
UiDevice myDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
Это выдает мне ту же ошибку, что бы я ни пытался, я работал над этим 2 дня, ничего не работает.
java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
Команда adb devices видит мое устройство, я могу запустить тесты с UiAutomator1,
Сервер Appium работает нормально, драйвер отлично подключается к локальным и облачным устройствам.
вот мой build.gradle, в последнее время я в нем много путаюсь:
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'LICENSE.txt'
}
compileSdkVersion 28
defaultConfig {
applicationId "com.example.mkiss.vonatinfo"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support.test:testing-support-lib:0.1'
implementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
implementation 'io.appium:java-client:6.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation 'junit:junit:4.12'
}
Спасибо за любые отзывы!