androidgradlebaseline-profile

Not able to Run test for Baseline profile using Gradle Managed Device


I have created a benchmark module and within its build.gradle file I have added a managed device as following:

testOptions {
        managedDevices {
            devices {
                pixel2api30 (com.android.build.api.dsl.ManagedVirtualDevice) {
                    device = "Pixel 2"
                    apiLevel = 30
                    systemImageSource = "aosp"
                    require64Bit = false
                }
            }
        }
    }

Whenever I run the command gradle :benchmark:pixel2api30Setup its working

But when I run the command gradle :benchmark:pixel2api30BenchmarkAndroidTest

It throws the following error:

Task 'pixel2api30BenchmarkAndroidTest' not found in project ':benchmark'.

Solution

  • Which version of AGP are you using?

    I was getting similar error but after upgrading AGP to 7.3.0-alpha07 from 7.2.2, I can now run the benchmark instrumentation task.

    As stated in the release preview notes:

    Make sure your project is using AGP version 7.3.0-alpha07 or higher.

    https://developer.android.com/studio/preview/features?hl=fr