I get many errors like this:Duplicate class org.jetbrains.annotations.TestOnly found in the following modules:...
This is an indication that i miss an exclude, but i have the following lines in my build.gtadle
configurations {
cleanedAnnotations
compile.exclude group: 'org.jetbrains' , module:'annotations'
compile.exclude group: 'org.jetbrains.kotlin' , module:'kotlin-stdlib'
compile.exclude group: 'com.intellij', module:'annotations'
}
So what is missing?
Edit:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//Firebase
implementation ("com.google.firebase:firebase-core:17.2.0") {
exclude group: "com.android.support", module: "support-v4"
}
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-plugins:2.0.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-ml-vision:24.0.0'
implementation ("com.google.firebase:firebase-auth:19.1.0") {
exclude group: "com.android.support", module: "support-v4"
}
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
//Graphview
implementation 'com.jjoe64:graphview:4.2.1'
implementation 'org.apache.commons:commons-lang3:3.4'
//Google Play
implementation ("com.google.android.gms:play-services-base:17.1.0") {
exclude group: "com.android.support", module: "support-v4"
}
implementation "com.google.android.gms:play-services-auth:17.0.0"
implementation "com.google.android.gms:play-services-identity:17.0.0"
//FirebaseUI
implementation 'com.firebaseui:firebase-ui-auth:6.0.2'
implementation 'com.firebaseui:firebase-ui-storage:6.0.2'
implementation 'com.facebook.android:facebook-android-sdk:5.8.0'
implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
//Support
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.appcompat:appcompat-resources:1.1.0"
implementation "androidx.navigation:navigation-fragment-ktx:2.2.1"
implementation "androidx.drawerlayout:drawerlayout:1.0.0"
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.preference:preference:1.1.0"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "io.reactivex.rxjava2:rxjava:2.2.13"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
//Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
/**
* dependency to request the runtime permissions.
*/
implementation 'com.karumi:dexter:4.2.0'
// code generator for view
implementation "com.jakewharton:butterknife:10.2.0"
annotationProcessor "com.jakewharton:butterknife-compiler:10.2.0"
testImplementation 'junit:junit:4.12'
}
So here are my dependencies, i have this packages not directly included, but somehow they are i guess indirectly.
This seems to be to much code for the post so i have to add some text
Remove implementation 'com.jjoe64:graphview:4.2.1' from your dependencies it is known to cause duplicate class errors.
You can also use implementation 'com.jjoe64:graphview:4.2.2'
Related
I have had an application with working Firestore. Then I tried adding Google Speech to Text to the application and suddenly Firestore connection stops working. Here I will post before and after app/build.gradle script in a hope that anyone could see the issue. I will not post the parts of the script that did not change.
Before:
dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'dev.dworks.libs:astickyheader:0.1.0'
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
implementation 'com.android.support:preference-v7:29.0.0'
implementation "androidx.appcompat:appcompat:1.1.0"
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.android.support:support-v4:29.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.firebase:firebase-firestore:21.6.0'
}
After
dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'dev.dworks.libs:astickyheader:0.1.0'
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
implementation 'com.android.support:preference-v7:29.0.0'
implementation "androidx.appcompat:appcompat:1.2.0"
//implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.android.support:support-v4:29.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation fileTree(include: '*.jar', dir: 'libs')
implementation ('com.google.firebase:firebase-firestore:21.6.0') {
exclude(group: 'com.google.firebase', module: 'firebase-database-collection')
exclude(group: 'com.google.firebase', module: 'firebase-auth-interop')
exclude(group: 'com.google.firebase', module: 'firebase-common')
}
implementation 'com.google.api.grpc:grpc-google-cloud-speech-v1:1.23.0'
implementation 'com.google.firebase:firebase-admin:6.2.0'
}
configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')
configurations.implementation.exclude(group: 'com.google.guava', module: 'guava-jdk5')
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
configurations.implementation.exclude(group: 'com.google.firebase', module: 'firebase-auth-interop')
configurations.implementation.exclude(group: 'com.google.firebase', module: 'firebase-common')*/
configurations.implementation.exclude(group: 'com.google.android.gms', module: 'play-services-basement')
The change produces the following error: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
What could be causing me these issues?
I am trying to create a build of my project but it's giving me error '''Program type already present: com.android.internal.http.multipart.ByteArrayPartSource'''. I understande some file in my dependency are duplicate. I have tried to exclude this group in various places but exactly couldn't find the correct way.
Following are the dependencies I am using
implementation project(':segmentControlLibrary')
implementation project(':googleplayservices_lib')
implementation project(':webservice')
implementation project(':PDFViewCtrlTools')
implementation files('libs/acra-4.5.0.jar')
implementation files('libs/httpmime-4.2.1.jar')
//compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation project(':library')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'it.sephiroth.android.library.horizontallistview:hlistview:1.3.1'
implementation 'net.zetetic:android-database-sqlcipher:4.2.0#aar'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.github.angads25:filepicker:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
implementation 'com.pdftron:pdftron:7.0.3'
implementation ('com.pdftron:tools:7.0.3'){
exclude group: 'com.google.code.gson', module: 'gson'
}
implementation files('libs/org.apache.http.legacy.jar')
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.material:material:1.1.0-alpha06'
Can anyone help which module might contain the error prone group, which I need to exclude.
Note : I can run directly app in the device but not able to create debug or release apk.
remove
implementation 'com.google.android.material:material:1.1.0-alpha06'
you already declare material library above as
implementation 'com.google.android.material:material:1.0.0'
Try this
android{
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
exclude 'org/apache/http/version.properties'
exclude 'org/apache/http/client/version.properties'
exclude 'org/apache/http/entity/mime/version.properties'
}
}
dependencies {
implementation project(':segmentControlLibrary')
implementation project(':googleplayservices_lib')
api project(':webservice')
implementation files('libs/acra-4.5.0.jar')
implementation project(':library')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'it.sephiroth.android.library.horizontallistview:hlistview:1.3.1'
implementation 'net.zetetic:android-database-sqlcipher:4.2.0#aar'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.github.angads25:filepicker:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
implementation 'com.pdftron:pdftron:7.0.3'
implementation('com.pdftron:tools:7.0.3') {
exclude group: 'com.google.code.gson', module: 'gson'
}
implementation 'com.android.support:multidex:1.0.3'
compileOnly files('libs/httpmime-4.5.10.jar')
compileOnly files('libs/httpcore-4.4.12.jar')
compileOnly files('libs/httpclient-4.5.10.jar')
implementation 'com.google.code.gson:gson:2.8.6'
}
I am facing some issue regarding the build. I am trying to integrate the google photos api in my app. So, I added the below dependency:
implementation 'com.google.photos.library:google-photos-library-client:1.3.0'
After that, I am facing build issue due to some conflict:
ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.16.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: io.grpc:grpc-okhttp:1.16.1 -> io.grpc:grpc-core#[1.16.1], but grpc-core version was 1.21.0
Here I am posting all the dependencies:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.1.1'
implementation 'com.android.support:support-v4:28.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.firebaseui:firebase-ui:4.3.2'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
// implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.ncorti:slidetoact:0.3.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-places:16.1.0'
implementation 'com.google.android.gms:play-services-drive:16.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.mikepenz:materialdrawer:6.1.1'
implementation 'com.akexorcist:googledirectionlibrary:1.1.1'
implementation 'com.roughike:bottom-bar:2.3.1'
implementation 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-vision:17.0.2'
implementation 'com.google.photos.library:google-photos-library-client:1.3.0'
// JSON Parsing
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.vipulasri:timelineview:1.0.6'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.seatgeek:placesautocomplete:0.3-SNAPSHOT'
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.1.2'
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('android.arch.work:work-runtime:1.0.0-alpha11') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-plus:16.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.apis:google-api-services-classroom:v1-rev135-1.23.0'
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.robertlevonyan.view:MaterialChipView:1.2.5'
implementation 'com.google.apis:google-api-services-calendar:v3-rev305-1.23.0'
implementation 'com.aurelhubert:ahbottomnavigation:2.3.4'
implementation 'us.belka:androidtoggleswitch:1.2.2'
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'
implementation "org.igniterealtime.smack:smack-tcp:4.1.0"
// Optional for XMPPTCPConnection
implementation "org.igniterealtime.smack:smack-android-extensions:4.1.0"
}
apply plugin: 'com.google.gms.google-services'
When adding
implementation
('com.google.android.ads.consent:consent-library:1.0.0') {
exclude module: 'androidx.activity'
}
to my app/build.gradle file i get this error:
Error: Program type already present: androidx.activity.R$attr
What i did do:
1. gradlew androidDependencies
But i cannot find any duplicates
Read: https://developer.android.com/studio/build/dependencies#duplicate_classes.
Other stackoverflow answers suggesting excluding support library versions dont help me
repositories {
maven { url 'https://maven.fabric.io/public' }
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
configurations.all {exclude group: 'com.android.support', module: 'support-v13'}
dependencies {
def nav_version = "1.0.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test:core-ktx:1.1.0'
implementation "com.vorlonsoft:androidrate:1.2.1"
implementation 'com.github.THEAccess:SuspendRx:1.0.10'
implementation 'com.github.THEAccess:privacydialog:0.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'com.yqritc:android-scalablevideoview:1.0.4'
implementation 'com.timqi.sectorprogressview:library:2.0.1'
implementation 'com.github.Angtrim:Android-Five-Stars-Library:v3.1'
implementation 'com.stepstone.apprating:app-rating:2.3.0'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.8'
implementation 'com.google.firebase:firebase-ads:16.0.1'
api ('com.google.android.ads.consent:consent-library:1.0.0') {
exclude module: 'androidx.activity'
}
//Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
//Kodein
def kodein_version = "6.0.1"
implementation "org.kodein.di:kodein-di-generic-jvm:$kodein_version"
implementation "org.kodein.di:kodein-di-framework-android-x:$kodein_version"
implementation "org.kodein.di:kodein-di-conf-jvm:$kodein_version"
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-config:16.4.0'
implementation 'com.google.firebase:firebase-perf:16.2.4'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9#aar') {
transitive = true;
}
implementation 'androidx.cardview:cardview:1.0.0'
}
Please help me understanding where the dependencies have duplicates
I had the same problem. Just using the Clean Project option and building it again worked for me...
It took me two days to fix it but here is the fix:
implementation ('com.google.android.ads.consent:consent-library:1.0.0') {
exclude group: 'androidx'
}
I integrate PayTabs payment getaway in my project
it run correct on my debugging version
then get this error when generate signing apk from my project
this error appear when generate sign apk
and this is my gradle dependences
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.android.support:gridlayout-v7:26.1.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.github.fccaikai:AndroidPermissionX:1.0.0'
implementation 'com.googlecode.android-query:android-query:0.25.9'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.github.rrsystems:utilsplus:1.1.0'
implementation 'com.romandanylyk:pageindicatorview:0.0.7'
implementation 'com.github.ragunathjawahar:android-saripaar:android-saripaar-2.0.3'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation 'com.github.chrisbanes:PhotoView:1.3.1'
implementation 'com.facebook.fresco:fresco:1.8.0'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.intuit.ssp:ssp-android:1.0.4'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'io.nlopez.smartlocation:library:3.3.1'
implementation project(':PayTabs_SDK')
I also got same problem after long research fortunately i find solution and here it's
configurations {
all*.exclude group: 'com.squareup.okio'
all*.exclude group: 'com.squareup.okhttp3'
all*.exclude group: 'com.android.support', module : 'support-v13'
}
Just put this code in app folder build.gradle file, it's look like
configurations {
all*.exclude group: 'com.squareup.okio'
all*.exclude group: 'com.squareup.okhttp3'
all*.exclude group: 'com.android.support', module : 'support-v13'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation project(':paytabs_SDK')
}
Paytabs SDK is using okhttp jar file, you can exclude okhttp by configuration
android {
configurations {
all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
}
https://github.com/JakeWharton/picasso2-okhttp3-downloader/issues/1#issuecomment-413993079