DataDog/dd-sdk-flutter

[Version: 2.0.0][Build] Unresolved reference: PerformanceTracker in Kotlin

bgenidy opened this issue · 1 comments

Describe what happened
Was attempting to migrate over to datadog_flutter_plugin 2.0.0

Steps to reproduce the issue:

  1. Upgrade to datadog_flutter_plugin 2.0.0
  2. Have the following configuration
final loggerConfiguration = DatadogConfiguration(
  clientToken: '', // set as empty in dev
  env: 'dev',
  site: DatadogSite.us1,
  nativeCrashReportEnabled: true,
  loggingConfiguration: DatadogLoggingConfiguration(),
  rumConfiguration: null,
)..enableHttpTracking();

await DatadogSdk.instance
      .initialize(loggerConfiguration, TrackingConsent.granted);
  1. build a bundle for android, get the below exception
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
e: file:///Users/bg/.pub-cache/hosted/pub.dev/datadog_flutter_plugin-2.0.0/android/src/main/kotlin/com/datadoghq/flutter/DatadogRumPlugin.kt:84:22 Unresolved reference: PerformanceTracker
e: file:///Users/bg/.pub-cache/hosted/pub.dev/datadog_flutter_plugin-2.0.0/android/src/main/kotlin/com/datadoghq/flutter/DatadogRumPlugin.kt:85:32 Unresolved reference: PerformanceTracker
e: file:///Users/bg/.pub-cache/hosted/pub.dev/datadog_flutter_plugin-2.0.0/android/src/main/kotlin/com/datadoghq/flutter/DatadogSdkPlugin.kt:311:16 Type mismatch: inferred type is Int but Map<String, *> was expected
e: file:///Users/bg/.pub-cache/hosted/pub.dev/datadog_flutter_plugin-2.0.0/android/src/main/kotlin/com/datadoghq/flutter/DatadogSdkPlugin.kt:313:17 Type mismatch: inferred type is Any but Map<String, *> was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':datadog_flutter_plugin:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1

Describe what you expected:
To build/run without any errors

Additional context

  • Dart/Flutter version: 3.16.0
  • Android/iOS OS version: N/A
  • Device Model: macOS 13.4.1 22F770820d darwin-arm64, locale en-US)
  • Datadog SDK version: 2.0.0

This was fixed by me running /gradlew assembleDebug --stacktrace which created a clean build. I had datadog version 1.2.1 before. So normal upgrade might not have cleaned up all the necessary metadata files causing this issue.