react-native-plaid-link-sdk
react-native-plaid-link-sdk copied to clipboard
Android Task :app:checkDebugDuplicateClasses FAILED
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 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"
Also just encountered this issue. Any idea on a fix? Seems like the android lib could be more flexible with its dependencies, perhaps?
@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
Note: In my case "react-native": "0.72.5",