D8, Android's dexer, optimizes Java `assert` statements by eliminating them in release builds (since Android VMs never enable assertions) and retaining them in debug builds via the `--force-enable-assertions` flag introduced in AGP 4.1. In release builds, D8 replaces the assertions-enabled check with `false` and uses dead-code elimination to strip the entire assertion expression from bytecode. In debug builds, the check is replaced with `true`, keeping the invariant check active at runtime. This brings Android assertion behavior closer to the JVM model where tests run with `-ea` but production does not. Kotlin's `assert()` function is not yet handled by this optimization.