Skip to content

Sentry crashes on android - No direct method <init> in SentryFrameMetricsCollector #4688

Open
@ljukas

Description

@ljukas

What React Native libraries do you use?

React Navigation, Hermes, Expo Application Services (EAS), Expo (mobile only), Expo Router

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.3.0

How does your development environment look like?

System:
  OS: macOS 15.3.2
  CPU: (16) arm64 Apple M4 Max
  Memory: 618.72 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.10.0
    path: ~/.nvm/versions/node/v23.10.0/bin/node
  Yarn:
    version: 4.5.3
    path: /opt/homebrew/bin/yarn
  npm:
    version: 11.2.0
    path: ~/.nvm/versions/node/v23.10.0/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/lukas/.gem/ruby/3.1.3/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "28"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 35.0.1
      - 36.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-VanillaIceCream | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.12816248
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.3
    path: /usr/bin/javac
  Ruby:
    version: 3.1.3
    path: /Users/lukas/.rubies/ruby-3.1.3/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Sentry.init()

const navigationIntegration = Sentry.reactNavigationIntegration({
  enableTimeToInitialDisplay: true,
  // Constants.executionEnvironment === ExecutionEnvironment.StoreClient,
});

Sentry.init({
  dsn: envConfig.sentryDsn,
  environment: envConfig.env,
  sendDefaultPii: true,
  attachScreenshot: true,
  tracesSampleRate: 1.0,
  profilesSampleRate: 1.0,
  integrations: [navigationIntegration, Sentry.httpClientIntegration()],
  enableNativeFramesTracking: true,
  // Constants.executionEnvironment === ExecutionEnvironment.StoreClient,
});

Steps to Reproduce

  1. Build a release build.
  2. Install on android phone
  3. Boot, instant crash

Expected Result

Expect app not to crash

Actual Result

Logcat output:

Error: Exception in HostFunction: java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;ILio/sentry/android/core/internal/util/SentryFrameMetricsCollector;Lio/sentry/ISentryExecutorService;Lio/sentry/ILogger;Lio/sentry/android/core/BuildInfoProvider;)V in class Lio/sentry/android/core/AndroidProfiler; or its super classes (declaration of 'io.sentry.android.core.AndroidProfiler' appears in /data/app/~~3b06jDoZwNkpsitpG2J-3A==/se.bovra.bovra.staging-r5YcvJgg0aPX9G9EhjMqdw==/base.apk!classes5.dex), js engine: hermes
2025-03-26 08:30:25.065 29169-29247 AndroidRuntime          se.bovra.bovra.staging               E  FATAL EXCEPTION: mqt_native_modules
Process: se.bovra.bovra.staging, PID: 29169
com.facebook.react.common.JavascriptException: Error: Exception in HostFunction: java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;ILio/sentry/android/core/internal/util/SentryFrameMetricsCollector;Lio/sentry/ISentryExecutorService;Lio/sentry/ILogger;Lio/sentry/android/core/BuildInfoProvider;)V in class Lio/sentry/android/core/AndroidProfiler; or its super classes (declaration of 'io.sentry.android.core.AndroidProfiler' appears in /data/app/~~3b06jDoZwNkpsitpG2J-3A==/se.bovra.bovra.staging-r5YcvJgg0aPX9G9EhjMqdw==/base.apk!classes5.dex), js engine: hermes, stack:
callNativeSyncHook@1:252902
nonPromiseMethodWrapper@1:251233
startProfiling@1:4196352
startProfiling@1:4213186
_startNewProfile@1:4215042
_startCurrentProfile@1:4214819
anonymous@1:3899591
emit@1:3899556
_startRootSpan@1:3871861
createChildOrRootSpan@1:3871233
anonymous@1:3870576
anonymous@1:3845144
withScope@1:3845710
withSetScope@1:3845104
withScope@1:3861363
anonymous@1:3870446
startInactiveSpan@1:3870397
_startIdleSpan@1:3867940
startIdleSpan@1:3865805
startIdleSpan@1:4242800
startIdleNavigationSpan@1:4242520
startIdleNavigationSpan@1:4252610
afterAllSetup@1:4252060
afterSetupIntegrations@1:3903279
_setupIntegrations@1:3899829
init@1:3898660
init@1:4244727
initAndBind@1:3909530
init@1:4247891
anonymous@1:7119417
loadModuleImplementation@1:222089
guardedLoadModule@1:221576
metroRequire@1:221249
get@1:1335719
metroContext@1:1330510
loadRoute@1:1596677
getLayoutNode@1:1598763
_loop@1:1596573
getDirectoryTree@1:1595689
getRoutes@1:1595398
getRoutes@1:1594623
initialize@1:1558168
anonymous@1:1556697
useMemo@1:572211
anonymous@1:354793
useInitializeExpoRouter@1:1556637
ContextNavigator@1:1660060
renderWithHooks@1:525487
beginWork@1:542933
performUnitOfWork@1:562157
workLoopSync@1:561287
renderRootSync@1:561119
flushSyncWorkAcrossRoots_impl@1:514954
scheduleUpdateOnFiber@1:558601
updateContainer@1:567757
anonymous@1:574312
renderElement@1:395006
renderApplication@1:349940
anonymous@1:341320
runApplication@1:341769
__callFunction@1:254027
anonymous@1:252464
__guard@1:253407
callFunctionReturnFlushedQueue@1:252422

  at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.kt:52)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:146)
  at com.facebook.jni.NativeRunnable.run(Native Method)
  at android.os.Handler.handleCallback(Handler.java:958)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
  at android.os.Looper.loopOnce(Looper.java:205)
  at android.os.Looper.loop(Looper.java:294)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2(MessageQueueThreadImpl.java:217)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    • Status

      Needs More Information
    • Status

      Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions