Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build the apk in andriod emulator after upgrading flutter and datadog to latest #514

Closed
rohith-alphanso opened this issue Nov 17, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@rohith-alphanso
Copy link

Thanks for taking the time for reporting an issue!

Describe what happened
I had upgraded my datadog dependencies the latest one, and my flutter app is not able run on android emulator

  - datadog_flutter_plugin: ^1.6.2
  - datadog_grpc_interceptor: ^1.0.0-beta.2
  - datadog_tracking_http_client: ^1.4.0

  + datadog_flutter_plugin: ^2.0.0
  + datadog_grpc_interceptor: ^1.0.0
  + datadog_tracking_http_client: ^2.0.0

Steps to reproduce the issue:
Upgrade the flutter to latest version, and upgrade the datadog dependencies to the latest version, and try to run the app in the android emulator

Describe what you expected:
The build is failing with the following error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDevDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class androidx.work.OneTimeWorkRequestKt found in modules work-runtime-2.8.1-runtime (androidx.work:work-runtime:2.8.1) and work-runtime-ktx-2.7.1-runtime (androidx.work:work-runtime-ktx:2.7.1)
     Duplicate class androidx.work.PeriodicWorkRequestKt found in modules work-runtime-2.8.1-runtime (androidx.work:work-runtime:2.8.1) and work-runtime-ktx-2.7.1-runtime (androidx.work:work-runtime-ktx:2.7.1)

Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

BUILD FAILED in 32s
Exception: Gradle task assembleDevDebug failed with exit code 1

Additional context

  • Dart/Flutter version:
Flutter 3.16.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision db7ef5bf9f (2 days ago) • 2023-11-15 11:25:44 -0800
Engine • revision 74d16627b9
Tools • Dart 3.2.0 • DevTools 2.28.2
@rohith-alphanso rohith-alphanso added the bug Something isn't working label Nov 17, 2023
@fuzzybinary
Copy link
Collaborator

fuzzybinary commented Nov 17, 2023

HI @rohith-alphanso,

Thanks for reporting the issue.

This is because we updated our Kotlin runtime in version 2.0. Can you check your android/build.gradle file and android/app/build.gradle file to see if you're adding a dependency on androidx.work:work-runtime-ktx? If so, does updating it to 2.8.0 or above fix your issue?

You may also want to check for the Kotlin gradle plugin (org.jetbrains.kotlin:kotlin-gradle-plugin) which we recommend be at 1.8.22 or above.

If these fix your issues, I'll make sure to add this to our MIGRATING and troubleshooting documentation.

Thanks!

(edit: add Kotlin gradle plugin info)

@rohith-alphanso
Copy link
Author

Hi Jeff,
we don't have any dependency on androidx.work:work-runtime-ktx
also org.jetbrains.kotlin:kotlin-gradle-plugin we are using version 1.9.0 which is aligns with recommended version

@rohith-alphanso
Copy link
Author

rohith-alphanso commented Nov 17, 2023

Hi Jeff,
The issue is fixed after adding this in dependencies

def work_version = "2.8.1"
implementation "androidx.work:work-runtime-ktx:$work_version"

in
android/app/build.gradle

@fuzzybinary
Copy link
Collaborator

Great to hear, thanks @rohith-alphanso . I'm curious if there was another library that depended on androidx.work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants