Skip to content

[Question] Proper way to test minified release build from test only module #2447

@lemberh

Description

@lemberh

I have a multi-module Android project with a dedicated e2e module for UI tests that applies the com.android.test plugin.
The test sources live under the main source set (not androidTest).

The goal is to run UI tests against the minified release build to verify ProGuard/R8 shrinking/obfuscation doesn’t break anything and the app doesn't crash.
However, I don’t want to minify the test code itself.

Current Build Setup

In the e2e module I configured build variants like this:

buildTypes {
    debug {
        matchingFallbacks += listOf("release")
    }
    create("appTest") {
        isMinifyEnabled = false
        initWith(getByName("debug"))
    }
}

Problem
When running tests, I get this error:

Mapping file found in tested application: .../app/build/outputs/mapping/release/mapping.txt
This means that the tested application has shrinking enabled.
For the test to work correctly, please enable shrinking in this test project as well

If I change the test build type to:

isMinifyEnabled = true

Then the test module fails because ProGuard/R8 shrinks the test code — and I don’t want the test code obfuscated or optimized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions