Skip to content

Android: mapping.txt not getting uploaded #357

@orestesgaolin

Description

@orestesgaolin

Environment

  • Codemagic build
  • Flutter 3.53.3 stable
  • using sentry_dart_plugin: ^3.1.1

Question: am I missing some obvious configuration or something is mutualy exclusive between Flutter and Android? What might be wrong with my config that the mapping.txt is not getting uploaded.

sentry:
  upload_debug_symbols: true
  # project: defined by env variable
  # auth_token: defined by env variable
  wait_for_processing: false
  log_level: info
  commits: auto
  ignore_missing: true
  upload_source_maps: true

Sentry init

await SentryFlutter.init(
  (options) {
    options
      ..dsn = appConfiguration.sentryDsn
      ..enableLogs = !kDebugMode
      ..anrEnabled = !kDebugMode
      ..attachStacktrace = !kDebugMode
      ..release = appConfiguration.buildVersion // e.g. 25.7.1
      ..dist = appConfiguration.buildNumber.toString() // e.g. 2453
      ..debug = kDebugMode
      ..environment = appConfiguration.appFlavor.name // e.g. testing
      ..addGqlExtractors()
      ..addExceptionCauseExtractor(UnknownExceptionExtractor())
      ..addExceptionCauseExtractor(NetworkExceptionExtractor())
      ..addExceptionCauseExtractor(CacheMissExceptionExtractor())
      ..addExceptionCauseExtractor(OperationExceptionExtractor())
      ..addExceptionCauseExtractor(CacheMisconfigurationExceptionExtractor())
      ..addExceptionCauseExtractor(MismatchedDataStructureExceptionExtractor())
      ..addExceptionCauseExtractor(UnexpectedResponseStructureExceptionExtractor())
      ..attachScreenshot = true
      ..beforeSend = (event, hint) {
        if (kDebugMode) {
          // Don't send events in debug mode
          return null;
        }
        return event;
      };
  },

Additionally I tried configuring sentry via gradle:

app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id "io.sentry.android.gradle"
}

sentry {
    debug = false
    autoInstallation {
      enabled = false
    }
    authToken = System.getenv("SENTRY_AUTH_TOKEN")
    includeProguardMapping = true
    autoUploadProguardMapping = true
    includeSourceContext = true
}

Codemagic publishing script

      scripts:
        - &sentry
          name: Sentry Symbols Upload
          ignore_failure: true
          script: |
            echo "Uploading debug symbols to Sentry"
            dart run sentry_dart_plugin --sentry-define=project$SENTRY_PROJECT --sentry-define=release="$PROJECT_BUILD_VERSION ($PROJECT_BUILD_NUMBER)"

Logs

sentry_symbols_upload (1).log

build_android_aab__shorebird_.log

I know that mapping.txt gets generated as it gets uploaded to GitHub

Image

Expected Result

ProGuard files should be visible in Sentry

Actual Result

Debug files are getting uploaded

Image

But Proguard mappings are empty

Image

And some stacktraces are not symbolicated:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions