Gmail Hide Ads

Removes sponsored conversation rows from the Gmail inbox before they are measured, so an advertisement leaves no row and no empty gap.

An advertisement is identified by its view class, not by the badge it renders. Gmail's English badge is the string resource string/ad, whose value is simply Ad; matching that text needs a word list in every language Gmail ships, and it collapsed ordinary mail during testing. The class name carries the same information and cannot be mistaken.

Gmail serves these advertisements in the Promotions and Social tabs. With the Promotions tab switched off in Gmail's settings, Gmail delivers none and the module has nothing to remove.

Scope

The module declares a static scope of:

com.google.android.gm

META-INF/xposed/scope.list carries that declaration, so no scope selection is required in the manager. Do not add other applications.

Requirements

  • A framework implementing the modern Xposed API, version 101 or newer. The legacy de.robv.android.xposed API is not used, so a framework implementing only that API cannot load this module.
    • Rooted: Vector on Android 8.1 or newer, with Magisk or KernelSU and Zygisk enabled.
    • Rootless: LSPatch, the JingMatrix fork. It embeds Vector into a patched Gmail APK and loads modern libxposed modules through the same runtime. The archived LSPosed/LSPatch build predates the modern API and cannot load this module.
  • Android 8.0 (API 26) or newer.
  • The official Gmail application (com.google.android.gm).

Installation

  1. Install the APK from the release attached to this repository.
  2. Enable Gmail Hide Ads in the framework manager. With LSPatch, select it when patching Gmail in manager mode, or embed it in integrated mode.
  3. Force-stop Gmail once, then reopen it.
  4. A working start-up logs the framework, the detected Gmail build, and the installed layer:
Gmail Hide Ads v1.0.0: loading in com.google.android.gm, framework=Vector 2.2, api=102
Host: 2026.08.17.974752392.Release (65972134)
Layer installed: ad-teaser
Active layers: 1/1

Each removal is logged with the class and view id that matched:

Collapsed advertisement row #1: com.google.android.gm.ads.adteaser.BasicAdTeaserItemView#basic_ad_teaser_item

How it works

Gmail is minified on every release, so almost nothing inside it keeps a stable name. Its advertisement rows are the exception, and that exception is what this module is built on.

Every Gmail ad row is inflated from a layout that names its root class in XML. R8 cannot rename a class a layout refers to by name, so these survive minification intact:

com.google.android.gm.ads.adteaser.BasicAdTeaserItemView
com.google.android.gm.ads.adteaser.VideoAdTeaserItemView
com.google.android.gm.ads.adteaser.ImageCarouselAdTeaserItemView
com.google.android.gm.ads.adteaser.RichButtonChipAdTeaserItemView
com.google.android.gm.ads.adteaser.AppInstallButtonChipAdTeaserItemView
com.google.android.gm.ads.adteaser.EuSingleImageAdTeaserItemView

The hook is installed on ViewGroup.addView(View, int, ViewGroup.LayoutParams) — the overload the other four public addView signatures funnel into, and the first moment a row has its layout parameters. Hooking an Android framework method rather than a Gmail class means a Gmail update does not move the hook point.

A view is classified by walking its superclasses for a name under com.google.android.gm.ads. ending in AdTeaserItemView, so a release that subclasses one of these is still recognized. The verdict is cached per class, because addView is a hot path. A matching row has its layout height zeroed and its visibility set to GONE before it is ever measured — both are required, since GONE stops the row drawing but a RecyclerView layout manager still measures its attached children.

The hook target is deoptimized through XposedInterface.deoptimize, because the shorter addView overloads are small enough for ART to inline and an already compiled caller could otherwise bypass the hook.

There is no restore path, and none is needed: Gmail gives an advertisement its own RecyclerView item type, so a row of one of these classes is never rebound to ordinary mail. If the layer cannot install, it is logged and skipped and Gmail is left exactly as it was.

The module carries no native library and no DEX-search dependency.

Validation

The ad row class names were read out of the compiled layouts of Gmail 2026.08.17.974752392.Release (65972134) and confirmed present and unrenamed in its DEX.

Measured on a Pixel 8 Pro running Android 17 with Vector 2.2 (libxposed API 102). A real sponsored row was collapsed in the Promotions tab, logged as BasicAdTeaserItemView#basic_ad_teaser_item, leaving the list with no advertisement and no empty gap. Gmail rendered normally throughout Primary, Promotions, Social, Updates and Forums under repeated scrolling, with no crash and no ordinary mail collapsed.

One caveat, stated plainly: Gmail delivers these advertisements intermittently, so a side-by-side capture of the same row with the module disabled was not obtained. The evidence is the logged removal of a genuine ad row instance, not a paired screenshot.

Troubleshooting

Problem Suggested action
No advertisement is ever removed Expected when none is being served. Gmail shows these only in the Promotions and Social tabs; with the Promotions tab switched off in Gmail's settings there is nothing to remove.
Sponsored rows still appear Confirm the module is enabled and that the log reports Active layers: 1/1. If the layer installed but nothing is collapsed, Gmail has probably renamed its ad row classes.
No module log entries at all Verify the module is enabled and Gmail is in scope, then force-stop Gmail once. The framework must implement libxposed API 101 or newer.
ViewGroup.addView hook rejected The framework refused the hook. Check that it reports API 101 or newer in the start-up line.
Rows not collapsed after a Gmail update Capture the Collapsed advertisement row lines, or their absence, along with the Host: line naming the Gmail build, and open an issue.
An advertisement briefly reappears while scrolling fast RecyclerView can re-attach a cached row through a path that bypasses addView. Report the Gmail version if this is reproducible.

Credits

Project Contribution
Vector by JingMatrix The ART hooking framework, and the method deoptimization used to reach inlined framework methods. GPL-3.0.
LSPatch by JingMatrix Embeds Vector into a patched APK, which is how this module runs without root. GPL-3.0.
libxposed API The modern Xposed module API this module compiles against. Apache-2.0.

Disclaimer

Not affiliated with, endorsed by, or sponsored by Google LLC. "Gmail" is a trademark of Google LLC and is used only to name the application this module targets. The module modifies Gmail's behaviour in memory on the user's own device; it does not redistribute or patch the Gmail APK, and it transmits nothing off the device. Provided for educational and personal use. App updates may break the hook without notice.

Releases

2.1.1

Stable

11/23/2026, 1:50:16 PM

Gmail Hide Ads v2.1.1

Ads are hidden again on Gmail 2026.11

Gmail 2026.11.09 moved its ad row classes from com.google.android.gm.ads to com.google.android.apps.gmail.libraries.ads, keeping their names. 2.1.0 found none of them there, fell back to the addView hook, and let every ad through.

Fixed

  • row.bf accepts both ad packages: a class is an ad row when its name starts with com.google.android.gm.ads. or com.google.android.apps.gmail.libraries.ads. and ends with AdTeaserItemView (docs/policy/row.md). The prefix machine became a trie that branches after com.google.android.; the name alphabet gained p and b (NC_P, NC_B, appended).
  • DexKit discovery searches both packages.

Also in this release

  • bfcc, the Brainfuck compiler written in Brainfuck, generates and checks the policy files; its output is byte-identical to the Python compiler's, so the shipped policy code is unchanged by it (docs/BFCC.md).

Verified

  • On a Pixel 8 Pro (Android 17, Vector 2.2, API 102) with Gmail 2026.11.09.1019722178.Release: DexKit found and row.bf accepted 6 ad row classes in 310 ms, 2 ms from the cache on the next start; the inflate layer installed; a live ImageCarouselAdTeaserItemView ad in Promotions was collapsed with no gap left (bfFailures=0).
  • Toolchain and program tests (26), BBC-built policy fixtures, the bfcc self-hosting chain, bfcc gen --check, and the JVM parity, robustness and benchmark suites (16) pass.

Older Gmail builds with the com.google.android.gm.ads package were covered by the parity tests only, not re-run on a device. LSPatch, 32-bit and x86 devices were not run for this release.

Version metadata

  • Version name: 2.1.1
  • Android version code: 5
  • Git tag: v2.1.1
  • APK filename: GmailHideAds-v2.1.1.apk

Updating

Install the v2.1.1 APK over 2.1.0. With Gmail running, Vector hot reloads it; otherwise force-stop and reopen Gmail. Confirm the framework log reports ad row class(es) found by DexKit with a non-zero count and Layer installed: ad-teaser inflate.

Assets

1

1.0.0

Stable

9/9/2026, 1:37:53 PM

First release in the Xposed Module Repository.

Removes sponsored conversation rows from the Gmail inbox before they are measured, matching an ad row by its view class rather than by badge text. Requires a framework implementing the modern Xposed API 101 or newer: Vector with root, or the JingMatrix fork of LSPatch without.

The application ID is io.github.mrxsin.gmailhideads. If you previously installed a build under the old my.MrxSiN prefix, this installs alongside it rather than upgrading it, so uninstall the old copy.

Assets

1

2.1.0

Stable

10/15/2026, 7:27:38 PM

Gmail Hide Ads v2.1.0

DexKit discovery, narrow hooks and hot reload

This release changes how rows are caught, not which rows are removed.

Changed

  • Ad row classes are found once at start-up with DexKit: every class in com.google.android.gm.ads is judged by the same row.bf program that judges rows at runtime. The names found are cached per Gmail build, so later cold starts skip the scan (about 2 ms instead of about 300 ms on a Pixel 8 Pro).
  • Only the ad rows are hooked: each one's own onFinishInflate, where the row is collapsed before it is ever measured, and collapsed again whenever it is attached, because Gmail's bind sets its visibility afterwards. The global ViewGroup.addView hook is now only the fallback when discovery finds nothing hookable.
  • Hot reload: installing a new build while Gmail runs swaps the module in place, with no force-stop.
  • Requires libxposed API 102 (minApiVersion=102).
  • Adds DexKit 2.2.0 (LGPL-3.0-or-later).

Verified

  • On a Pixel 8 Pro (Android 17, Vector 2.2, API 102) with Gmail 2026.09.07.986350278.Release: DexKit found and row.bf accepted all six ad row classes in 289 ms; the next cold start read them from the cache in 2 ms; installing this build over 2.0.0 hot reloaded into the running Gmail process (same PID), replaced the hooks and took the stale one off.
  • gradle check: Brainfuck generation, toolchain tests, parity and robustness suites and lint pass.

Gmail served no advertisement during testing, so the collapse of a live ad row by the new hook has not yet been observed; the fallback addView path is the one validated on 1.0.0. LSPatch, 32-bit and x86 devices were not run for this release.

Version metadata

  • Version name: 2.1.0
  • Android version code: 4
  • Git tag: v2.1.0
  • APK filename: GmailHideAds-v2.1.0.apk

Updating

Install the v2.1.0 APK over 2.0.0. With Gmail running, Vector hot reloads it; otherwise force-stop and reopen Gmail. Confirm the framework log reports Layer installed: ad-teaser inflate.

Assets

1