R8 only ever ran on `release`, so every automated gate in this repository exercised code the shipped APK does not contain. Reflective lookups, JNI callbacks and native library loading can all break under shrinking while `flutter test`, the Robolectric suites and `connectedDebugAndroidTest` stay green — which is exactly how #1703 shipped, with the bundled FFmpeg audio renderer shrunk out of release builds for TrueHD and DTS-HD. Add a `minified` build type that inherits release's shrinker configuration but stays debuggable and debug-signed, so it is an ordinary test artifact and never a publishable one. Three integration details took a run each to find: the Flutter plugin copies app build types into every plugin module, so library-level shrinking deleted the plugin entry points that only GeneratedPluginRegistrant references; the harness must not be shrunk or the runner disappears; and androidx.test has to survive in the app under test, or the runner cannot link its own supertype and the run reports zero tests instead of failing. Instrumentation still defaults to `debug`, because only one build type can host androidTest and the existing playback suites drive media3 builder APIs the app never calls, which R8 shrinks legitimately. The new reachability test opts into the minified variant instead and touches no builder API, so the only keeps it depends on are the ones under test. Emptying proguard-rules.pro was verified to fail it.
12 lines
575 B
Prolog
12 lines
575 B
Prolog
# Shrinker rules for the instrumentation APK of the `minified` variant.
|
|
#
|
|
# That variant exists to run R8 over the app under test, not over the harness. AGP
|
|
# applies the app's rules to the test APK too, which deletes the instrumentation runner
|
|
# and every test class the runner resolves by name — the run then dies with
|
|
# ClassNotFoundException before a single test starts. The harness is never shipped, so
|
|
# it has nothing to gain from shrinking.
|
|
-dontshrink
|
|
-dontoptimize
|
|
# The runner resolves the instrumentation class and every -e class filter by name.
|
|
-dontobfuscate
|