Search code examples
react-nativesentryrelease-apk

Sentry not working properly in react native release Apk


Sentry is working properly in debug mode and but when I make a release APK and run it it doesn't give proper information like it gave in debug APK. and I cant identify any issue with the code . if anyone knows about this issue please help.


Solution

  • Minified Names in Production When bundling for production, React Native will minify class and function names to reduce the bundle size. This means that you won't get the full original component names in your Touch Event breadcrumbs or Profiler spans.

    A way to work around this is to set the displayName on all the components you want to track with touch events or to pass the name prop to the Profiler components. However, you can also configure Metro bundler to not minify function names by setting these options in metro.config.js:

    module.exports = {
      transformer: {
        minifierConfig: {
          keep_classnames: true, // Preserve class names
          keep_fnames: true, // Preserve function names
          mangle: {
            keep_classnames: true, // Preserve class names
            keep_fnames: true, // Preserve function names
          },
        },
      },
    };

    Paste the above snippet in your metro.config.js file in react native project