I am fully upgrading my application to androidx
Have removed android.enableJetifier=true
from gradle.properties
Also removed the support library dependency implementation 'androidx.legacy:legacy-support-v4:1.0.0'
This is my app level gradle dependencies
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(project(':mylib'))
implementation 'com.google.android.gms:play-services-ads:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.browser:browser:1.3.0'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.google.android.exoplayer:exoplayer:2.15.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation "androidx.core:core-ktx:1.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.exoplayer:extension-ima:2.15.1'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}
I have a module mylib
having the same dependencies
dependencies {
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
api 'com.google.android.gms:play-services-ads:16.0.0'
api 'com.google.android.gms:play-services-location:16.0.0'
api 'androidx.browser:browser:1.3.0'
api 'com.google.android.exoplayer:exoplayer:2.13.3'
implementation 'com.android.volley:volley:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.core:core:1.7.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.24.0'
implementation 'com.google.code.gson:gson:2.8.9'
}
I still get the following error
Duplicate class android.support.customtabs.ICustomTabsCallback found in modules browser-1.3.0-runtime (androidx.browser:browser:1.3.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.3.0-runtime (androidx.browser:browser:1.3.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)
CodePudding user response:
first step use gradle help tool analysis which lib include Duplicate class
finally use exclude
implementation("") { // or api exclude group: '', module: '' }
CodePudding user response:
With help from @shuabing's answer was able to solve this Custom tabs was included in play services and browser dependency which caused this issue
Solved it by
implementation ('com.google.android.gms:play-services-ads:16.0.0'){
exclude group: 'com.android.support', module: 'customtabs'
}