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 :)
Related
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)
This question already has answers here:
Duplicate class androidx.lifecycle.ViewModelLazy found in modules lifecycle-viewmodel-2.5.0-runtime
(8 answers)
Closed 5 months ago.
How can I fix this logcat error in flutter when i added local_auth: ^2.1.2 to my project
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.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
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.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
Here is the kotlin plugin added by default in the build gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
So i can,t really tell where the error is coming from i have tried to clean, rebuild the project and also invalidate and restart andriod studio but the error still persists. Any advice will be greatly appreciated. Thanks
Go to gradle.properties(project properties)
Add
android.enableJetifier=true
And also most of time android.useAndroidX=true is present.Check your gradle.properties(Project Properties) and if it does not exist then add
android.useAndroidX=true
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.
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
Following the advice from https://developers.google.com/cast/support, I'm posting this question.
I've developed an Android app that integrates Google Cast functionality. My app also uses protobuf-java:3.9.1 to implement part of its functionality.
This weekend I decided to update the app's dependencies. The app built and worked just fine prior to my attempt to update the dependencies.
I was previously using play-services-cast-framework:17.0.0, and updated this to 17.1.0. When I did this I picked up a transitive dependency on protobuf-lite:3.0.1, which contains classes that conflict with protobuf-java:3.9.1 causing the build to fail.
My question: Is this new dependency on an old version of protobuf a bug introduced in play-services-cast-framework:17.1.0?
Excerpt from the build error messages:
* What went wrong:
Execution failed for task ':mobile:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-3.9.1.jar (com.google.protobuf:protobuf-java:3.9.1) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules protobuf-java-3.9.1.jar (com.google.protobuf:protobuf-java:3.9.1) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
...
There are several more duplicate class errors, which I've omitted.
As reported by the androidDependencies gradle task, when I use cast framework 17.1.0, I pick up the following new dependencies that are not present when I used cast frameworkd 17.0.0:
...
+--- com.google.android.datatransport:transport-backend-cct:2.0.1#aar
+--- com.google.android.datatransport:transport-runtime:2.0.0#aar
...
+--- com.google.android.datatransport:transport-api:2.0.0#aar
+--- com.google.dagger:dagger:2.22#jar
+--- javax.inject:javax.inject:1#jar
+--- com.google.protobuf:protobuf-lite:3.0.1#jar
...