X AdFree

English

面向 X Android 客户端的 LSPosed 去广告模块,基于 libxposed Modern API 102 与 DexKit 运行时动态解析。

功能

  • 去除首页时间线(For You / Following)广告。
  • 去除帖子详情页和评论区广告。
  • 通过目标数据模型(URT promoted metadata、entryId 前缀、应用自身广告判定)三态识别广告;不确定的内容一律放行,以此尽量避免误删正常帖子(不承诺绝对零误删)。
  • 在 URT 数据层单一汇聚点过滤,所有消费时间线的界面同时受益,不依赖具体界面布局。
  • 运行时用 DexKit 按字符串指纹、方法签名、类型形状多特征定位目标方法,按目标应用安装身份缓存解析结果;下一次启动直接命中缓存,无需重新解析。
  • 内置运行时见证(witness)校验:钩子安装后首次真实调用必须符合 URT 数据形状,否则自动卸载自己并使缓存失效,杜绝误钩非目标方法。
  • 不修改 X APK,不拦截网络请求,也不包含后台服务、轮询、WakeLock 或 Frida 代码。唯一打包的 native 库是 DexKit 自带的 libdexkit.so,仅在解析阶段使用。

兼容性

项目 要求
目标应用 面向 X 12.x 小版本动态适配,当前真机验证 12.17.0-release.0(12.3.1 仅作为历史兼容种子保留,未在 2.0.x 架构上重新实测)
Android 9.0(API 28)及以上
框架 支持 libxposed Modern API 102 的官方 LSPosed
模块版本 2.0.2(versionCode 21)

模块按"特征指纹 + 形状校验 + 运行时见证"解析目标,而非硬编码类名表。小版本通杀的工程定义:普通 X 小版本升级不需要维护逐版本 Hook 表;当业务语义和调用结构仍可识别时,通过运行时 DexKit + Verifier + Witness 自动重新定位目标;遇到大版本或业务架构代际变化时,允许重新分析最新版并更新 Resolver/指纹。不承诺对未来任意版本零维护。若 X 未来重构导致指纹全部失效,模块会以失效安全(fail-open)方式放弃过滤并保留 X 正常可用。

X 11.82.0 之后包含 libpairipcore.so。使用本模块前,需要在官方 LSPosed 的“设置 → 还原内联钩子”中勾选 X(com.twitter.android),否则 X 可能在冷启动时终止进程。

工作原理(简述)

  1. X 主进程启动时,模块记录安装身份(包名、APK 及 split 尺寸、签名证书哈希、versionCode),形成稳定 token;versionCode 只用于缓存失效,不参与业务分支。
  2. 首次运行:DexKit 按 7 个 discovery 入口(5 个高熵业务字符串、结构入口、历史种子)定位 URT emit 钩子点,候选按正交特征打分;分数不足或存在歧义时,最多 5 个候选先挂只读探针,观察到 ≥2 次真实调用且元素形状占比达标才晋升。时间线模型接口与应用广告判定方法并行解析。
  3. 应用自身的广告判定(boolean helper)在运行时语义见证通过之前只以低于删除阈值的权重参与评分——单个被错误解析的 helper 不可能独立删除正常内容;见证发现矛盾时立即禁用该 helper。
  4. 解析结果按身份写入缓存(原子替换、LRU 上限);此后每次启动先逐目标验证缓存仍可加载且形状正确,才复用(缓存与全新解析使用同一套验证规则)。
  5. 钩子安装后由运行时见证校验首个真实数据形状,不符时真实卸载钩子并使该缓存条目失效;广告判定三态评分,仅移除确定性广告,不确定内容一律放行。过滤只替换 ArrayList 输出,未知 List 实现直接放行(fail-open)。
  6. 引导状态机单线程串行化,READY/DEGRADED 终态冻结;20 秒引导watchdog只覆盖解析阶段,探针观察期有独立的 30 秒期限,互不干扰。

详细分析(指纹矩阵、状态机、discovery 矩阵)见 docs/analysis-12.17.0.md

安装

  1. 从 GitHub Releases 下载并安装 APK。
  2. 在 LSPosed 的“还原内联钩子”设置中确认已勾选 X。
  3. 在 LSPosed 中启用 X AdFree;静态作用域只包含 X。
  4. 强制停止 X 后重新打开。首次启动会进行一次 DexKit 解析(约 1 秒),之后启动直接命中缓存(几十毫秒内生效)。

模块没有设置页面,开关、作用域和“还原内联钩子”均通过 LSPosed GUI 管理。

构建

需要 JDK 17、Android SDK 35,并可从 Maven Central 获取 io.github.libxposed:api:102.0.0org.luckypray:dexkit:2.0.6

.\gradlew.bat :app:testDebugUnitTest :app:assembleDebug

测试 APK 输出到 app/build/outputs/apk/debug/。面向普通用户的已签名版本请从 GitHub Releases 下载。

许可证

本项目采用 MIT License

免责声明

本项目仅供学习、研究和个人设备使用,与 X Corp.、Twitter 或 LSPosed 项目无隶属或认可关系。使用前请确认符合当地法律及相关服务条款。

Releases

2.0.2

Stable

8/21/2026, 5:58:31 AM

Release Notes — X AdFree 2.0.2(versionCode 21)

中文

从 1.5.1 到 2.0.2:一次架构换代

1.5.1 是绑定 X 12.3.1 类名的单版本模块——X 每发一个小版本,模块就会失效并等待人工适配。2.0.x 把这层"版本绑定"整个换成了运行时动态适配

  • 安装时按"特征指纹 + 形状校验 + 运行时见证"在 X 进程内自动定位过滤点,不维护任何逐版本类名表;
  • 普通 X 小版本更新(混淆名漂移)由 DexKit 指纹梯子自动吸收,多数情况下无需等模块更新;
  • 解析结果按安装身份缓存,日常启动几十毫秒内生效;
  • 任何时候解析或验证失败,模块都会以失效安全(fail-open)方式放弃过滤,X 本身保持完全可用

功能与体验

  • 去除首页时间线(For You / Following)、帖子详情页与评论区的广告;
  • 广告识别基于数据模型语义(promoted 元数据 / entryId 前缀 / 应用自身判定)三态评分:只有确定性广告会被移除,不确定内容一律放行,以此尽量避免误删正常帖子(不承诺绝对零误删);
  • 无设置页:开关、作用域、还原内联钩子全部通过 LSPosed GUI 管理。

纯净运行时

  • 模块自身零联网:无更新检查、无远程配置、无遥测,APK 甚至未声明 INTERNET 权限;
  • 无后台服务、无轮询、无 WakeLock;解析线程空闲后自动退出,只保留随 X 进程存在的过滤钩子。

兼容性与验证

  • 面向 X 12.x 小版本动态适配;当前真机验证 12.17.0-release.0(12.3.1 仅作为历史兼容种子保留,未在 2.0.x 架构上重新实测);
  • Android 9.0(API 28)及以上;需支持 libxposed Modern API 102 的官方 LSPosed;
  • 遇到 X 大版本架构换代导致指纹全部失效时,模块会安全退避(不去广告但 X 正常),等待版本更新。

升级说明

  1. 直接安装覆盖升级(签名不变);
  2. 确认 LSPosed 中模块已启用、作用域仅 X(com.twitter.android);
  3. 保持 LSPosed"设置 → 还原内联钩子"中勾选 X(libpairipcore.so 需要);
  4. 强制停止 X 后重新打开。首次启动进行一次性解析(约 1 秒),之后启动直接命中缓存。

已知限制

  • 非 12.17.0 的未来小版本尚未实测(架构上可自适配,但不承诺零维护);
  • X 若删除全部已知业务指纹,模块 fail-open 放弃过滤直至版本更新。

English

1.5.1 → 2.0.2: an architecture change

1.5.1 was bound to X 12.3.1 class names — every minor X update broke it until manually re-patched. 2.0.x replaces that binding with runtime dynamic adaptation:

  • Filter points are located inside the X process via feature fingerprints, shape verification and a runtime witness — no per-version class tables;
  • Ordinary X minor updates (obfuscation drift) are absorbed automatically by the DexKit fingerprint ladder in most cases;
  • Resolved targets are cached per install identity; everyday launches take effect within tens of milliseconds;
  • Whenever resolution or verification fails, the module fails open — X itself keeps working unfiltered.

Features

  • Removes ads from the Home timeline (For You / Following), post detail pages and replies;
  • Detection scores semantic data-model evidence (promoted metadata / entryId prefixes / the app's own ad predicate) with tri-state verdicts: only confirmed ads are removed, uncertain items always pass through, minimizing the chance of normal posts being dropped (not an absolute guarantee);
  • No settings screen: everything is managed through the LSPosed GUI.

Pure runtime

  • The module itself makes zero network connections: no update checks, no remote config, no telemetry — the APK does not even declare the INTERNET permission;
  • No background services, no polling, no wake locks; the resolver thread exits when idle, leaving only the filter hook that lives with the X process.

Compatibility

  • Dynamically adapted to X 12.x minor versions; currently verified on 12.17.0-release.0 (12.3.1 is retained only as a historical compatibility seed, not re-tested on the 2.0.x architecture);
  • Android 9.0 (API 28)+ with official LSPosed supporting libxposed Modern API 102;
  • On a generational X redesign that invalidates every fingerprint, the module fails open until an update.

Upgrade

  1. Install over the previous version (same signing key);
  2. Confirm the module is enabled in LSPosed with scope limited to X (com.twitter.android);
  3. Keep X selected under LSPosed Settings → Restore inline hooks (required by libpairipcore.so);
  4. Force-stop X and reopen. The first launch performs a one-time resolution (~1s); later launches hit the cache.

Known limitations

  • Future minor versions beyond 12.17.0 are not yet tested (the architecture self-adapts, but zero maintenance is not promised);
  • If X removes all known business fingerprints, the module fails open until updated.

Assets

1

1.5.1

Stable

8/14/2026, 9:03:58 AM

This release only changes the module package name; functionality is unchanged.

Release notes

Ad removal for the X Android app, covering the Home timeline, post detail pages, and replies.

Compatibility

  • X 12.3.1-release.0 (versionCode 312031000)
  • Android 9.0 or later
  • Official LSPosed with libxposed Modern API 102 support

Installation

  1. Download and install the APK below.
  2. Select X under LSPosed Settings → Restore inline hooks.
  3. Enable X AdFree in LSPosed and force-stop X before reopening it.

SHA-256

90f26fdf5f56d7f3a0d88b12b1f38bf5e302b2e9bd4af749a4519573e2183717

Assets

1