Skip to content

Conversation

@chungdaniel
Copy link
Contributor

Problem

Users reported NoSuchMethodError crashes when initializing Amplitude (#283). The error occurred due to Gradle resolving different versions of analytics-android at compile-time vs runtime.

Root Cause

The dependency was specified as a version range [1.22,2.0). When Android SDK v1.22.4 added a new constructor parameter to Configuration, it created a binary incompatibility. Kotlin's default parameter handling generates specific bytecode signatures that don't match when the constructor signature changes.

Two scenarios can cause the crash:

1. Dependency Conflict Resolution:

  • Flutter plugin compiles against v1.22.4 (52 parameters)
  • Another library forces v1.22.3 at runtime (51 parameters)
  • Result: NoSuchMethodError

2. Gradle Lockfile + Incremental Build:

  • Plugin compiled against v1.22.3 (lockfile)
  • Lockfile updated to v1.22.4
  • Incremental build doesn't recompile plugin
  • Result: Old bytecode + new library = NoSuchMethodError

Solution

Lock Android SDK to specific version 1.22.4 to ensure compile-time and runtime use the same version.

Changes

  • android/build.gradle: analytics-android:[1.22,2.0)analytics-android:1.22.4
  • Added comment documenting the version lock rationale

Testing

  • ✅ Example app builds and runs without crashes
  • ✅ All existing functionality preserved

Closes #283

@k0shk0sh
Copy link

I hope this gets merged soon!

@chungdaniel chungdaniel merged commit a4ffb5b into main Oct 14, 2025
4 checks passed
@chungdaniel chungdaniel deleted the lock-sdk-versions-2 branch October 14, 2025 18:26
justin-fiedler pushed a commit that referenced this pull request Oct 14, 2025
## [4.3.9](v4.3.8...v4.3.9) (2025-10-14)

### Bug Fixes

* lock iOS and Android SDK dependencies to specific versions ([#284](#284)) ([a4ffb5b](a4ffb5b))
@github-actions
Copy link

🎉 This PR is included in version 4.3.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@k0shk0sh
Copy link

this issue came back! please have a look in: #283

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No direct method <init>

3 participants