Skip to content

[FIX] Android: Custom Datadog upload options not set correctly and Gradle error#879

Merged
marco-saia-datadog merged 1 commit into
developfrom
marcosaia/fix/gradle-error-config-file-path
May 14, 2025
Merged

[FIX] Android: Custom Datadog upload options not set correctly and Gradle error#879
marco-saia-datadog merged 1 commit into
developfrom
marcosaia/fix/gradle-error-config-file-path

Conversation

@marco-saia-datadog
Copy link
Copy Markdown
Member

What does this PR do?

Fixes upload options not being extracted correctly from project.ext on Android, and Gradle error triggered when using dd-sdk-android-gradle-plugin.

Explanation

We currently try to access the upload options from the project object, instead of project.ext, leading to properties not being parsed properly, but failing silently.

Furthermore, a build error is triggered when dd-sdk-android-gradle-plugin is used, by including the plugin in the app/build.gradle, as shown below:

plugins {
    id("com.datadoghq.dd-sdk-android-gradle-plugin") version "<version>"
}

The reason is that the plugin defines a custom extension of type com.datadog.gradle.plugin.DdExtension, accessible through project.datadog, leading to the following error:

Could not get unknown property 'configurationFilePath' for extension 'datadog' of type
com.datadog.gradle.plugin.DdExtension.

Reported in #878.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

Copy link
Copy Markdown
Contributor

@sbarrio sbarrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@marco-saia-datadog marco-saia-datadog merged commit d6a8878 into develop May 14, 2025
8 checks passed
@marco-saia-datadog marco-saia-datadog deleted the marcosaia/fix/gradle-error-config-file-path branch May 14, 2025 15:07
@cdn34dd cdn34dd mentioned this pull request May 22, 2025
4 tasks
@FrikkieSnyman
Copy link
Copy Markdown

Hey @marco-saia-datadog 👋

I believe this change doesn't play well with the expo plugin (v52.0.1 at least).

Given the following expo plugin config (in an expo project's app.config.ts):

[
      'expo-datadog',
      {
        errorTracking: {
          serviceName: 'custom-service-name',
          iosSourcemaps: true,
          androidSourcemaps: true,
        },
      },
    ]

The android/app/build.gradle gets modified as follows:

plugins {
    id("com.datadoghq.dd-sdk-android-gradle-plugin") version "1.14.0"
}

datadog {
    checkProjectDependencies = "none"
    serviceName = "custom-service-name"
}
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply from: "node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle"

When the datadog-sourcemaps.gradle gets evaluated, the function getServiceName returns the variant.applicationId, since the check project.ext.has("datadog") && project.ext.datadog.serviceName) is false.

Bit of a niche regression, but I would expect the expo-plugin to align with this change, too.

Keen to hear your thoughts whether I'm missing something here!

@marco-saia-datadog
Copy link
Copy Markdown
Member Author

@FrikkieSnyman Thank you for reaching out!

You are absolutely right 🙏 I have created an issue on expo-datadog to keep track of progress: DataDog/expo-datadog#62.

We will take care of this and keep you posted 🙌

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants