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

Android Task :app:checkDebugDuplicateClasses FAILED #608

Open
AslamJM opened this issue Nov 15, 2023 · 3 comments
Open

Android Task :app:checkDebugDuplicateClasses FAILED #608

AslamJM opened this issue Nov 15, 2023 · 3 comments

Comments

@AslamJM
Copy link

AslamJM commented Nov 15, 2023

The problem

Error on yarn android app failed to build.

Environment

Plaid Link React Native ^11.0.3
ReactNative Version 0.72.6
Occurs on Android yes
Android OS Version
Android Devices/Emulators lenov0 k14
Occurs on iOS not tested
iOS Version
iOS Devices/Emulators
Link Session ID

Steps to Reproduce

failure in build

Screenshots

If this is a visual bug a screenshot would be helpful.

Logs

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.0-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0) and lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.0-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0) and lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0)

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

@AslamJM I also experienced this issue in our demo application. I added these lines to my apps build.gradle. I am still investigating if there is a way to solve this at the SDK level.

    // Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.0-runtime
    // (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0) and lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0)
    // Ref - https://stackoverflow.com/a/74869127/7245977.
    def lifecycle_version = "2.5.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

@jdconley
Copy link

jdconley commented Jan 12, 2024

Also just encountered this issue. Any idea on a fix? Seems like the android lib could be more flexible with its dependencies, perhaps?

@zahid502
Copy link

zahid502 commented Feb 1, 2024

@AslamJM

@SonamSharmac6160
This worked for me (file path: android/build.gradle)

add ext.kotlin_version = '1.8.0-Beta' in buildscript
add classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" in dependencies

check in image
Screenshot 2024-02-01 at 6 51 35 PM

Note: In my case "react-native": "0.72.5",

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

No branches or pull requests

4 participants