react-native-plaid-link-sdk icon indicating copy to clipboard operation
react-native-plaid-link-sdk copied to clipboard

Android Task :app:checkDebugDuplicateClasses FAILED

Open AslamJM opened this issue 1 year ago • 3 comments

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>.

AslamJM avatar Nov 15 '23 04:11 AslamJM

@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"

dtroupe-plaid avatar Nov 15 '23 17:11 dtroupe-plaid

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

jdconley avatar Jan 12 '24 04:01 jdconley

@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",

zahid502 avatar Feb 01 '24 14:02 zahid502