You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Method too large: XMTPModule.definition fails to compile on Android #777
Building the Android app with @xmtp/react-native-sdk fails during compileDebugKotlin with a MethodTooLargeException. The generated definition { ... } method in XMTPModule.kt exceeds the JVM's 64KB bytecode-per-method limit.
Error
exception: exception: java.lang.RuntimeException: Error generating class file expo/modules/xmtpreactnativesdk/XMTPModule.class
(compiled from [...\node_modules@xmtp\react-native-sdk\android\src\main\java\expo\modules\xmtpreactnativesdk\XMTPModule.kt]):
Method too large: expo/modules/xmtpreactnativesdk/XMTPModule.definition ()Lexpo/modules/kotlin/modules/ModuleDefinitionData;
caused by: org.jetbrains.org.objectweb.asm.MethodTooLargeException:
Method too large: expo/modules/xmtpreactnativesdk/XMTPModule.definition ()Lexpo/modules/kotlin/modules/ModuleDefinitionData;
at org.jetbrains.org.objectweb.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2088)
at org.jetbrains.org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:512)
Environment
@xmtp/react-native-sdk: 5.7.0
Kotlin: 2.1.20
KSP: 2.1.20-2.0.1
Android buildTools: 36.0.0
compileSdk / targetSdk: 36
minSdk: 24
NDK: 27.1.12297006
Expo SDK: 57.0.16
React Native: 0.86.2
OS: Windows
Build command: npx expo run:android
Steps to reproduce
Install @xmtp/react-native-sdk@5.7.0 in an Expo project.
Run npx expo run:android.
Build fails at :xmtp-react-native-sdk:compileDebugKotlin with the above error.
Expected behavior
The module should compile successfully.
Additional notes
The definition { } block in XMTPModule.kt appears to have grown large enough (with the full set of exported functions/events across client, conversations, groups, messages, streaming, etc.) that the compiled definition() method now exceeds the JVM's 64KB method size limit. Splitting the exported functions into multiple smaller registered Function(...) blocks, or delegating each function body to a separate private method (rather than inlining logic directly in the DSL), would likely resolve this.
Ran ./gradlew clean and ./gradlew --stop before retrying — same failure.
Activity
felixkamau commentedon Aug 20, 2026
@nplasterer hi am facing an issue with the react native package
nplasterer commentedon Aug 20, 2026
Thanks for the ping @felixkamau I no longer maintain this package but maybe @cameronvoell or @neekolas could help out. 🙏
fix(example): pin Expo 55, polyfill Buffer, document both
fix(example): pin Expo 55, polyfill Buffer, document both
XMTP builds on Android and reports install times there