Duplicate class error while building project android - android

I am building my project and getting the following errors of duplicate class
Duplicate class android.support.customtabs.ICustomTabsCallback found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.ICustomTabsCallback$Stub found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.ICustomTabsCallback$Stub$Proxy found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.ICustomTabsService found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.ICustomTabsService$Stub found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.ICustomTabsService$Stub$Proxy found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.IPostMessageService found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.IPostMessageService$Stub found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.customtabs.IPostMessageService$Stub$Proxy found in modules browser-1.4.0-runtime (androidx.browser:browser:1.4.0) and customtabs-26.1.0-runtime (com.android.support:customtabs:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
These are my gradle dependencies
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation files('libs/release.aar')
implementation "androidx.browser:browser:1.3.0"
implementation "com.google.android.gms:play-services-ads:16.0.0"
implementation "com.google.android.gms:play-services-location:16.0.0"
implementation "com.google.android.exoplayer:exoplayer:2.17.1"
implementation "com.google.android.exoplayer:extension-ima:2.17.1"
}

Was to able to solve by adding android.enableJetifier=true in gradle.properties file

Related

android.arch.persistence.room:runtime:1.1.1 dependency causing duplicate class error

my application is failing to build apk due to this error
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.7.0-runtime (androidx.core:core:1.7.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
I have tried to create a new project to understand the cause but it all the same.The project build the apk first after creation and when i add
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
but the moment i add
implementation 'android.arch.persistence.room:runtime:1.1.1'
All build after that fails i haven't writing any code yet in the project just the two dependencies i am trying to add as i understand that i need both to work but i can't figure out why the build fail despite it been a new project and no other dependency has been included yet just the default dependency
here is what my dependency currently looks like
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
}
Thanks

Task :app:checkDebugDuplicateClasses FAILED java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.firebase_messaging.zza found

The app was working perfectly when I did some changes last time. but suddenly getting the issue of firebase.
implementation project(':react-native-firebase')
implementation 'com.android.support:support-v4:+'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation project(':react-native-device-info')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
..... other dependencies
implementation 'com.google.firebase:firebase-messaging:16.1.0
getting error
Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzb found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzc found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzd found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zze found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzf found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzh found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzm found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzn found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzo found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzp found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzq found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzr found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
I had same problem here, suddenly android stop work. I'm using react-native 0.61.5.
Here three ways you can solve this issue:
First way: (solved my problem)
On your android/build.gradle add this line to ext section:
firebaseVersion = "21.1.0"
Second way: (also solved my problem)
If the first way not work, maybe you should have to do a little bit more. In your android/buld.gradle:
firebaseMessagingVersion = "21.1.0"
buildToolsVersion = "29.0.2"
firebaseCoreVersion = "17.0.0"
firebaseVersion = "21.1.0"
on your android/app/build.gradle, add this:
implementation 'com.google.firebase:firebase-messaging:21.1.0'
Third way
You will need to find all dependencies of firebase that are brake your application, pay attention for you node_modules dependencies that are using something related to firebase. Once you have all dependencies mapped, you will need to specify versions on your android/build.gradle and android/app/build.gradle.
Notes:
Sorry for my english, i tried.
i was having this issue, i found that firebase-iid worked on the same version than firebase-messaging, but now the messaging version is 22.0.0 and the mayor version of firebase-iid is 21.1.0, so yo have to separate the dependencies with each corresponding version.
Used below firebase-messaging version
implementation 'com.google.firebase:firebase-messaging:21.1.0'
Good Luck!
removing implementation 'com.google.firebase:firebase-analytics on your
android/app/build.gradle

Duplicate class org.webrtc.AndroidVideoDecoder while using Jitsi Sdk and quickblox-android-sdk

I am using
com.quickblox:quickblox-android-sdk-videochat-webrtc:3.9.1 for Chat
and
org.jitsi.react:jitsi-meet-sdk:2.10.0 //for Meeting
but unable to resolve these issues
Duplicate class org.webrtc.AndroidVideoDecoder found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.AndroidVideoDecoder$1 found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.AndroidVideoDecoder$DecodedTextureMetadata
found in modules jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.AndroidVideoDecoder$FrameInfo found in
modules jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.AudioProcessingFactory found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.AudioSource found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.AudioTrack found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.BaseBitrateAdjuster found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.BitrateAdjuster found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.CallSessionFileRotatingLogSink found in
modules jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.CalledByNative found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.CalledByNativeUnchecked found in modules
jetified-google-webrtc-1.0.25003-runtime
(org.webrtc:google-webrtc:1.0.25003) and
jetified-react-native-webrtc-1.84.0-jitsi-5385907-runtime
(com.facebook.react:react-native-webrtc:1.84.0-jitsi-5385907)
Duplicate class org.webrtc.Camera1Capturer found in modules
jetified-google-webrtc-1.0.25003-runtime
Probably a late answer but for future reference, both of the dependencies are using WebRtc as a transitive dependency and thus duplicate classes
implementation ('org.jitsi.react:jitsi-meet-sdk:2.10.0') {
transitive = true
exclude group: 'com.facebook.react', module: 'react-native-webrtc'
}

Duplicate classes when building app with firebase-firestore and google-cloud-language - android

I'm getting duplicate class errors when I try to build android app that use firebase-firestore and google-cloud-language.
Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
...
Duplicate class com.google.type.TimeOfDayProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
My build.gradle looks like follow:
...
dependencies {
...
implementation 'com.google.firebase:firebase-ml-vision:20.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'io.grpc:grpc-okhttp:1.19.0'
implementation'com.google.cloud:google-cloud-language:1.76.0'
}
How can I solve the issuse ?

Manifest merger error with com.google.android.material:material

I am getting following error :
Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
.......
andin my gradle file there is following dependencies
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
}
I do not know what is the problem I tried multiple solution including this but did not get rid of this. Please help
It seems like a conflict between androidX and support libs.
If you are not supporting yet androidX you need to replace
implementation 'com.google.android.material:material:1.0.0' by implementation 'com.android.support:design:28.0.0'.
If you still want to use the material version, make sure your gradle.properties file has androidX and Jetifier enabled.
android.useAndroidX=true
android.enableJetifier=true
Make sure you follow the necessary setup to use material. Check it out here.

Categories

Resources