Duplicate classes error while trying to update android facebook sdk - android

I am facing duplicate classes error while updating facebook Android SDK version com.facebook.android:facebook-android-sdk:15.0.1'
Duplicate class javax.annotation.Generated found in modules jetified-javax.annotation-api-1.3.2 (javax.annotation:javax.annotation-api:1.3.2) and jetified-jsr250-api-1.0 (javax.annotation:jsr250-api:1.0)

Related

Problems when executing an app for wear OS on android studio

Im trying to run my project on a smartwatch on android studio but I keep getting these two errors and I dont know what it is.
Execution failed for task ':app:checkDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.6.0-runtime (androidx.core:core:1.6.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.6.0-runtime (androidx.core:core:1.6.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.6.0-runtime (androidx.core:core:1.6.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)

Android Studio Dolphin 2021.3.1: Error while building project

I just recently upgraded from Arctic Fox to Dolphin and migrated my project from Gradle 7.0.3 to 7.3.0.
When I want to build project I got error:
Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.4.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.4.0)
Duplicate class androidx.lifecycle.ViewModelProviderKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.4.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.4.0)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.4.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.4.0)
My entire project is non-usable and broken right now.
This happened with me when I added the androidx.preference.preference-ktx:1.2.0
dependency in gradle.
Just add this dependency in build.gradle file to fix this.
Java ->
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
Kotlin ->
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
This error occurs due to one of the dependencies having an explicit dependency of lifecycle 2.3.1.
Google Tracker Issue Link -> https://issuetracker.google.com/issues/242384116
Hope this helps :)

Duplicate class error from conflicting WebRTC library in React Native app

I've been looking workaround for the past few days but no avail. I'm using Voximplant only for instant messaging (IM) and wanted to use Sinch for VOIP calls to the other app. As Sinch IM doesn't fit our use case so we used Voximplant for the messaging which I first implemented.
Now I couldn't build with react-native-sinch-voip due to Voximplant SDK also contains VOIP functions, causing both libraries to conflict in WebRTC classes during build.
I managed to solve the conflict in iOS by renaming the CallManager class name but unable to resolve for Android.
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class org.webrtc.AddIceObserver found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AndroidVideoDecoder found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AndroidVideoDecoder$1 found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AndroidVideoDecoder$DecodedTextureMetadata found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AndroidVideoDecoder$FrameInfo found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AudioDecoderFactoryFactory found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AudioEncoderFactoryFactory found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AudioProcessingFactory found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AudioSource found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.AudioTrack found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.BaseBitrateAdjuster found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.BitrateAdjuster found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.BuiltinAudioDecoderFactoryFactory found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.BuiltinAudioEncoderFactoryFactory found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
Duplicate class org.webrtc.CallSessionFileRotatingLogSink found in modules jetified-sinch-android-rtc-4.8.6+b14862c-runtime (sinch-android-rtc-4.8.6+b14862c.aar) and jetified-voximplant-sdk-2.27.0-runtime (com.voximplant:voximplant-sdk:2.27.0)
...
I've tried several solution suggested, adding below code to app/build.gradle but couldn't get it work. Not sure if I'm using the right syntax as well. I'm not familiar with native Android, hence seeking for help.
implementation(project(':react-native-voximplant')){
exclude group: 'com.voximplant', module:'org.webrtc.*'
}
configurations {
all*.exclude module: 'org.webrtc.AndroidVideoDecoder'
}
Unfortunately, it is not possible to use Voximplant React Native SDK with other SDKs based on WebRTC. Voximplant SDK is based on specific version of WebRTC library with extra patches and excluding WebRTC native library from Voximplant Android SDK will lead to undefined behavior.
We are currently working on a major update for Voximplant SDK that will allow to use Voximplant messaging API without WebRTC dependency, however it takes several months to complete this version.

React Native - Android Animated WebP is not working

I am trying to play an animated webp file on android devices. I am using react-native-animated-webp package but I got an error while building the app.
When I added the following lines into app/build.gradle file:
implementation("com.facebook.fresco:fresco:2.0.0")
// For animated GIF support
implementation 'com.facebook.fresco:animated-gif:2.0.0'
// For WebP support, including animated WebP
implementation 'com.facebook.fresco:animated-webp:2.3.0'
implementation 'com.facebook.fresco:webpsupport:2.3.0'
I got this error :
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfo found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Is there anyone who faced this issue before? How can I solve it?
I upgraded Flipper Version to FLIPPER_VERSION=0.99.0 then Fresco version from 2.0.0 to 2.5.0 then cd android && ./gradlew clean it worked for me

Getting duplicate class error by migrating from paging 2 to paging 3

I'm using Paging library version 2 in my project, and I want to migrate into version 3. Now I'm getting this error: Duplicate class kotlin.reflect.KClasses found in modules jetified-kotlin-reflect-1.1.1.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.1) and jetified-kotlin-stdlib-1.3.71.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.71)
Can anyone knows how can I resolve it?

Categories

Resources