I use a virtual Gradle-managed device (link) to create a virtual device in CI/CD workflow on GitHub. This does work well and I can run instrumented tests using with virtual device. The virtual device is created automatically and then close after tests.
My issue is that I need to use local files in the tests.
- Is there an option to map local files/folders into the virtual device?
- May be there is a specific path I can use in virtual device to access local files?
Here is an example of virtual device specification.
android {
testOptions {
managedDevices {
localDevices {
pixel2api30 {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 30
// To include Google services, use "google".
systemImageSource = "aosp"
}
}
}
}
}
In see several possible solutions:
- There should be an option how to do this using virtual managed devices, but it's not enough documentation. I checked API of ManagedVirtualDevice and TestOptions, didn't find suitable solution.
- The emulator can be created manually without usage of virtual Gradle-managed device. Then using adb files can be pushed to the emulator. Not an easy, but possible case.
- Create Custom Test Lab to support h/w device with prepared files on the device.
Thank you.