Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]Support older Android versions #1207

Open
ashishb opened this issue Jun 29, 2023 · 5 comments
Open

[Feature Request]Support older Android versions #1207

ashishb opened this issue Jun 29, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@ashishb
Copy link

ashishb commented Jun 29, 2023

Is your feature request related to a problem? Please describe.
Some issues show up only on older versions of Android

Describe the solution you'd like
Support older versions of Android at least till API 21.

@ashishb ashishb added the enhancement New feature or request label Jun 29, 2023
@ashishb ashishb changed the title [Feature Request] [Feature Request]Support older Android versions Jun 29, 2023
@camoles
Copy link

camoles commented Jul 11, 2023

As per my attempts, the minimum android api level on which maestro will run today is 26, but that is not documented anywhere. I made a pull request to fix the documentation. To help further on this issue, I also tried to run on api levels 21 and newer and found that the issue is that, on older versions, maestro is trying to use an adb command that is unsupported there to list packages installed, and then it is not able to continue. I may help with this in the future if I get sponsorship, but as it is today we cannot adopt maestro since supporting api levels 21 and above is a requirement for the project.

@camoles
Copy link

camoles commented Jul 11, 2023

Meanwhile, this line indicates that maestro indeed intended to support Android API levels 21 and newer, but still versions older than 26 are broken.

@ashishb
Copy link
Author

ashishb commented Jul 30, 2023

maestro is trying to use an adb command that is unsupported there to list packages installed, and then it is not able to continue.

Do you know which command is that?
I know a few things about ADB and might be able to find a portable replacement.

@testifyqa
Copy link
Contributor

This has affected my team as we need to run specifcally on devices using API 25.

I've had a quick look into this and think I see the issue...

The AndroidDriver has this function which gets called

private fun startInstrumentationSession() {
        val startTime = System.currentTimeMillis()
        val instrumentationCommand = "am instrument -w -m -e debug false " +
            "-e class 'dev.mobile.maestro.MaestroDriverService#grpcServer' " +
            "dev.mobile.maestro.test/androidx.test.runner.AndroidJUnitRunner &\n"

        while (System.currentTimeMillis() - startTime < getStartupTimeout()) {
            instrumentationSession = dadb.openShell(instrumentationCommand)

            if (instrumentationSession.successfullyStarted()) {
                return
            }

            instrumentationSession?.close()
            Thread.sleep(100)
        }
        throw TimeoutException("Maestro instrumentation could not be initialized")
    }

This adb command that is run does not seem to work with that -m flag on API 25 and below.

❯ adb shell am instrument -w -m -e debug false -e class 'dev.mobile.MaestroDriverService#grpcServer' dev.mobile.maestro.test/androidx.test.runner.AndroidJUnitRunner
Error: Unknown option: -m

I reckon I can have a go at raising a PR to fix this command for API 25 and below versions, and use this default one still for API 26 and above, unless someone else beats me to it.

@testifyqa
Copy link
Contributor

I have fixed this and raised a PR here -> #1527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants