android-test icon indicating copy to clipboard operation
android-test copied to clipboard

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

Open lemberh opened this issue 3 months ago • 0 comments

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.

lemberh avatar Oct 31 '25 17:10 lemberh