android / android/android-test

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

Open
#2,447 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start with the e2e module's buildTypes configuration and the com.android.test plugin variant handling described in the issue. Reproduce the test run against the app's minified release output, then determine whether the supported configuration can keep test code unminified while accepting the release mapping. Done means the UI tests run successfully against the minified app without shrinking the test code.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, mobile, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.