How to overcome Duplicate class issue while using Google Places SDK - android

I am converting my android app from older version of places SDK to the newer one as the older one is being decommissioned from July 29th. I made the changes as suggested by the documentation.
While compiling , I see loads of duplicate class error messages from classes that I don't use it evidently from my own code. Though they could used in libraries.
Duplicate class com.bumptech.glide.GeneratedAppGlideModule found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.GenericTransitionOptions found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Glide found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.GlideBuilder found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.GlideBuilder$1 found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.GlideContext found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.ListPreloader found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.ListPreloader$PreloadModelProvider found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.ListPreloader$PreloadSizeProvider found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.ListPreloader$PreloadTarget found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.ListPreloader$PreloadTargetQueue found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.MemoryCategory found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Priority found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Registry found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Registry$MissingComponentException found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Registry$NoImageHeaderParserException found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Registry$NoModelLoaderAvailableException found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Registry$NoResultEncoderAvailableException found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.Registry$NoSourceEncoderAvailableException found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.RequestBuilder found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.RequestBuilder$1 found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.RequestBuilder$2 found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
Duplicate class com.bumptech.glide.RequestManager found in modules classes.jar (com.github.bumptech.glide:glide:4.3.1) and glide-4.3.1.jar (com.github.bumptech.glide:glide:4.3.1)
I came up across the repo's issues page but see no worthwhile updates
https://github.com/bumptech/glide/issues/3527
here goes my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.xxxxx.xxxxxx"
minSdkVersion 16
targetSdkVersion 26
versionCode 28
versionName '3.7'
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds false
abortOnError false
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
pickFirst 'META-INF/LICENSE.txt' // picks the JavaMail license file
}
productFlavors {
}
}buildscript {
repositories {
maven {
url "https://maven.java.net/content/groups/public/"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.ramotion.foldingcell:folding-cell:1.2.2'
implementation 'com.sun.mail:android-mail:1.5.5'
implementation 'com.sun.mail:android-activation:1.5.5'
//implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
implementation 'com.applandeo:material-calendar-view:1.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'gun0912.ted:tedpermission:2.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.github.chrisbanes:PhotoView:2.1.0'
implementation 'commons-lang:commons-lang:2.6'
implementation 'org.jsoup:jsoup:1.10.1'
implementation 'com.google.android.libraries.places:places:1.1.0'
}
apply plugin: 'com.google.gms.google-services'
I tried to exclude the classes for compilation using gradle but I seem to be doing something wrong here (Quite new to Gradle though).
configurations {
compile.exclude group: 'com.bumptech.glide' , module: 'glide'
}
Is this snippet fine to exclude those classes being compiled ? and could I just add them in app's build.gradle?
Thank you so much for your inputs. Much appreciated

Related

Android Studio showing Duplicate class found

When generating release build android studio throwing below errors. Which i am not able to resolve. I tried many way which related issue mentioned but didn't succeed.
Duplicate class com.google.android.gms.internal.measurement.zzhx found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzmz found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzna found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.internal.measurement.zznb found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.internal.measurement.zznc found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.internal.measurement.zznd found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzga found in modules jetified-play-services-measurement-19.0.0-runtime (com.google.android.gms:play-services-measurement:19.0.0) and jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2)
Duplicate class com.google.android.gms.measurement.internal.zzhe found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhf found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhg found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhh found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhi found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhj found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzio found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzit found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.0-runtime (com.google.android.gms:play-services-measurement-impl:19.0.0)
I also added android.useAndroidX=true android.enableJetifier=true inside gradle.properties file.
My build.gradle file looks like below
apply plugin: 'com.android.application'
android {
namespace 'com.pp.prescriptionpatriot'
compileSdkVersion 32
defaultConfig {
applicationId "com.pp.prescriptionpatriot"
minSdkVersion 29
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
// Branch: required for all Android apps
implementation 'io.branch.sdk.android:library:5.2.3'
// Branch: required if your app is in the Google Play Store (tip: avoid using bundled play services libs)
implementation 'com.google.firebase:firebase-appindexing:20.0.0' // App indexing
implementation 'com.google.android.gms:play-services-ads:21.2.0' // GAID matching
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation project(':capacitor-android')
testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
implementation project(':capacitor-cordova-android-plugins')
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.google.firebase:firebase-appindexing:19.1.0'
//implementation 'androidx.work:work-runtime:2.7.1'
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
I fixed this replacing below implementation as per #VineshChauhan comment.
From
implementation 'com.google.android.gms:play-services-ads:21.2.0'
To
implementation 'com.google.android.gms:play-services-ads:20.4.0'
In your gradle.properties file, Add below line then rebuild your project.
android.enableJetifier=true

Duplicate class in build.gradle file

I have included following dependencies in build.gradle file. I get the following errors. How to fix them.I have included following dependencies in build.gradle file. I get the following errors. How to fix them.I have included following dependencies in build.gradle file. I get the following errors. How to fix them.I have included following dependencies in build.gradle file. I get the following errors. How to fix them.I have included following dependencies in build.gradle file. I get the following errors. How to fix them.I have included following dependencies in build.gradle file. I get the following errors. How to fix them.
build.gradle:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.testimageuploadhttp"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
def butterKnifeVersion = "8.4.0"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.jakewharton:butterknife:${butterKnifeVersion}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.annotation:annotation:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:4.10'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
//noinspection DuplicatePlatformClasses,DuplicatePlatformClasses
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
//Volley Library - You need to add this line
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
//Add this line
implementation 'net.gotev:uploadservice:3.4'
}
error:
Duplicate class org.hamcrest.BaseDescription found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.BaseMatcher found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.CoreMatchers found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.Description found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.Factory found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.Matcher found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.SelfDescribing found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.StringDescription found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.AllOf found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.AnyOf found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.DescribedAs found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.Is found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsAnything found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsEqual found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsInstanceOf found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsNot found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsNull found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsSame found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.internal.ArrayIterator found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.internal.SelfDescribingValue found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.internal.SelfDescribingValueIterator found in modules jetified-hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and jetified-junit-4.10 (junit:junit:4.10)
Go to the documentation to learn how to Fix dependency resolution errors.
testImplementation 'junit:junit:4.+'
testImplementation 'junit:junit:4.12'
are duplicated, but it is not because of that. I tried commenting out 1. It happens only when I add
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
else things compile fine.
The problem is that the org.hamcrest:hamcrest-core: classes are bundled in Junit also .So to fix the problem follow these steps:---->
----> 1) Click on build and clean the project
clean project
----> 2) add code in buid.gradle
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('org.hamcrest:hamcrest-core:1.1') with module('junit:junit:4.10')
}
}
So for anyone same problem to fix but can't exclude JUnit.
Well the solution is very pretty simple but very strange
You have duplicated your dependencies. Entries:
testImplementation 'junit:junit:4.+'
testImplementation 'junit:junit:4.12'
Are pointing to the same library

Implementation of library giving duplicate error

im trying to implement the 'com.github.barteksc:android-pdf-viewer:2.8.2' into my project and i am able to sync the gradle files but when i try to start the app it gives me this error
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.5.0-
runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Go to the documentation to learn how to Fix dependency resolution errors
i do not get why i will post my build.gradle below
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.jenson.resumeapp"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
i do not seem to find anything on this that works?
Add these lines in gradle.properties file
android.useAndroidX = true
android.enableJetifier = true
I was running into the same issue when I was implementing :
com.github.shts:StoriesProgressView:3.0.0
The problem, in my case at least, was that StoriesProgessView dependency was retrieving the same class from com.android.support:support-compat which is now already present in the androidx core package, causing the conflict to rise up.
This is how I went about it:
By checking out the Dependency tree, I found out that the StoriesProgressView was bringing in these dependencies, to remove those dependencies, I added the exlusion rule to the dependency like so:
implementation ('com.github.shts:StoriesProgressView:3.0.0') {
exclude group: "com.android.support", module: "support-compat"
exclude group: "com.android.support", module: "support-media-compat"
}
this stopped pulling the classes from the old package.
In your case though, there doesn't seem to be any third-party dependency so probably following Malik Ali's answer should suffice. If it doesn't, give this one a go!
Add this line in gradle.properties
android.enableJetifier = true

What is Duplicate class found in modules classes.jar error in Android Studio (when trying to connect to Firebase) and how to solve it?

I am trying to use Firebase database in my Android App ut I'm dealing with some errors:
I got this error first:
Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:6:5-24:19 to override.
I searched a way to fix it and found that migrating to AndroidX would be a good thing to do. But after I migrated to AndroidX (Refactor -> Migrate to AndroidX) I got this 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:28.0.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:28.0.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:28.0.0)
Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.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:28.0.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:28.0.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:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.core.internal.package-info found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.NonParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelUtils found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$ParcelException found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$InputBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Android Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.appv1">
<application
tools:node="replace"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.appv1"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// Displaying images
implementation 'com.github.bumptech.glide:glide:3.6.1'
// Firebase
implementation 'com.google.firebase:firebase-database:9.6.0'
// Add the SDKs for any other Firebase products you want to use in your app
// For example, to use Firebase Authentication and Cloud Firestore
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-firestore:21.2.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
}
repositories {
jcenter()
maven { // <-- Add this
url 'https://maven.google.com/'
}
}
apply plugin: 'com.google.gms.google-services'
build.gradle (Project:Appv1)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I think it is a dependency error because implementation 'com.android.support:appcompat-v7:28.0.0'is underlined in red.. but I don't know how to fix it.. Can anyone please help me?

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