Я хочу иметь возможность вызвать функцию во время тестирования пользовательского интерфейса Espresso, чтобы повернуть устройство от портрета на ландшафт. У меня есть совершенно новый эмулятор API 34, мои инструменты SDK показывают, что у меня есть эмулятор Android 36.x.x, AGP 8.12 на Narwhal. Это должно быть далеко за пределами всех минимальных рекомендаций.androidx.test.espresso.device.controller.DeviceControllerOperationException: Failed to set screen orientation. Please make sure the Android Emulator version is updated to 33.1.11+ and the controller gRPC service is enabled on the emulator. See https://developer.android.com/studio/te ... device_api for setup instructions.
...
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE
...
Caused by: java.net.ConnectException: failed to connect to /10.0.2.2 (port 8554) from /:: (port 0): connect failed: ENETUNREACH (Network is unreachable)
< /code>
Когда я работаю в CI, я получаю немного другую ошибку: < /p>
androidx.test.espresso.device.controller.DeviceControllerOperationException: Unable to connect to Emulator gRPC port. Please make sure the Android Emulator version is updated to 33.1.11+ and the controller gRPC service is enabled on the emulator. See https://developer.android.com/studio/te ... device_api for setup instructions.
< /code>
Обновление: похоже, что это сетевая проблема, связанная с моей управляемой работой машиной. Он отлично работает на моем физическом устройстве Android, в нашем неуправляемом CI, и если я запускаю эмулятор внутри Android Studio. Код выглядит как < /p>
val device = UiDevice.getInstance(getInstrumentation())
device.setOrientationLandscape()
Подробнее здесь: https://stackoverflow.com/questions/797 ... eenorienta