Skip to content

fix: resolve #1310 — 编译报主dex超过65536错误#1794

Open
Nam0101 wants to merge 1 commit into
Tencent:devfrom
Nam0101:contribai/improve/quality/detect-agp-3-x-d8-and-apply-compatible-m
Open

fix: resolve #1310 — 编译报主dex超过65536错误#1794
Nam0101 wants to merge 1 commit into
Tencent:devfrom
Nam0101:contribai/improve/quality/detect-agp-3-x-d8-and-apply-compatible-m

Conversation

@Nam0101
Copy link
Copy Markdown

@Nam0101 Nam0101 commented May 16, 2026

Summary

fix: resolve #1310 — 编译报主dex超过65536错误

Problem

Severity: Medium | File: tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/TinkerPatchPlugin.groovy

AGP 3.x switched to D8 and changed how main-dex lists are computed. The plugin should detect the AGP version and choose a code path that works with D8's stricter main-dex rules, rather than relying on legacy DX behavior. Without this, projects with many libraries hit the 64K main-dex limit even though only a handful of classes truly need to load before multidex install.

Solution

Locate the AGP version detection (commonly a VERSION_3_X_X constant or a check on com.android.builder.Version.ANDROID_GRADLE_PLUGIN_VERSION). When AGP >= 3.0, route through the D8-compatible task wiring and ensure additionalParameters '--minimal-main-dex' is passed to the dex/transform task when the user opts into minimal main dex. Document the new flag in README and the issue template so users on com.android.tools.build:gradle:3.2.1 have a clear remedy.

Changes

  • tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/TinkerPatchPlugin.groovy (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

Note: this change was drafted with AI assistance and reviewed locally before submission.

Fixes Tencent#1310

Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
@tencent-adm
Copy link
Copy Markdown
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

编译报主dex超过65536错误

2 participants