I am totally new to android studio. I am trying to read some text using Firebase-ML, but I am getting duplicate class error when I try to run the program
Error:
Duplicate class com.google.android.gms.internal.vision.zzu found in modules jetified-play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and jetified-play-services-vision-image-labeling-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Here are my Gradle dependencies.
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
implementation 'com.google.firebase:firebase-ml-vision-image-label-model:20.0.2'
implementation 'com.google.android.material:material:1.2.1'
}
I don't know what to do here?
I think this might be the same I ran into when adding another Google API. Try adding the following to your build.gradle:
android {
.
.
.
// Firebase uses a smaller proto but other Google APIs uses the full system so I need to exclude the
// light libraries when using Google APIs with Firebase and then Firebase will use the
// full library
configurations {
implementation.exclude module: 'protobuf-lite'
}
Related
After upgrading Microsoft Graph dependency in my project from implementation 'com.microsoft.graph:microsoft-graph:2.10.0' to implementation 'com.microsoft.graph:microsoft-graph:3.0.0' the compilation fails with following error:
Duplicate class javax.activation.ActivationDataFlavor found in modules jetified-activation-1.1 (javax.activation:activation:1.1) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.CommandInfo found in modules jetified-activation-1.1 (javax.activation:activation:1.1) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
...
Duplicate class javax.activation.UnsupportedDataTypeException found in modules jetified-activation-1.1 (javax.activation:activation:1.1) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Have any of you seen this before, and how do I fix this behaviour ?
Anyone knows if the changes in v3.0.0 are so severe that they can`t coexist with this dependency scheme ?
dependencies {
implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-perf-ktx'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
implementation 'androidx.core:core-ktx:1.5.0-beta03'
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'androidx.camera:camera-camera2:1.1.0-alpha02'
implementation 'androidx.camera:camera-lifecycle:1.1.0-alpha02'
implementation 'androidx.camera:camera-view:1.0.0-alpha22'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0-beta01'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.4'
implementation 'androidx.fragment:fragment-ktx:1.3.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.room:room-runtime:2.3.0-beta03'
kapt 'androidx.room:room-compiler:2.3.0-beta03'
implementation 'androidx.room:room-testing:2.3.0-beta03'
implementation 'androidx.room:room-ktx:2.3.0-beta03'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.2.0-beta02'
implementation ('com.microsoft.identity.client:msal:2.0.8')
{exclude group: 'com.microsoft.device.display'}
implementation ('com.microsoft.graph:microsoft-graph:3.0.0')
implementation 'com.google.android.material:material:1.4.0-alpha01'
//Guava, to avoid conflict on ListenableFuture on jetified-guava-20.0 (com.google.guava:guava:20.0)
// and jetified-listenablefuture-1.0 (com.google.guava.listenablefuture:1.0)
// https://stackoverflow.com/questions/56639529/duplicate-class-com-google-common-util-concurrent-listenablefuture-found-in-modu
implementation 'com.google.guava:guava:30.1-jre'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.maps.android:android-maps-utils:2.2.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
}
Actually this version change is breaking, and here is the migration guide:
https://www.github.com/microsoftgraph/msgraph-sdk-java/tree/dev/docs%2Fupgrade-to-v3.md
But you might also add some exclusions in your packaging option in build.gradle (:app) like:
packagingOptions{
exclude("META-INF/INDEX.LIST")
exclude("META-INF/AL2.0")
exclude("META-INF/LGPL2.1")
exclude("META-INF/LICENSE.md")
exclude("META-INF/NOTICE.md")
exclude("META-INF/io.netty.versions.properties")
}
You might need add some more...
I tried to make an object from FirebaseVisionLabelDetectorOptions class but my app doesn’t import it
I got this error . And this is my dependencies
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:19.3.0'
implementation 'com.wonderkiln:camerakit:0.13.1'
implementation 'com.github.d-max:spots-dialog:1.1#aar'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-ml-vision:18.0.1'
implementation 'com.google.firebase:firebase-ml-vision-image-label-model:17.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
You are using the Cloud Landmarks API so you will need the Cloud Options class
FirebaseVisionCloudDetectorOptions options =
new FirebaseVisionCloudDetectorOptions.Builder()
.setModelType(FirebaseVisionCloudDetectorOptions.LATEST_MODEL)
.setMaxResults(15)
.build();
The Cloud based APIs work differently to on-device ones, so the options will be slightly different.
Code was working properly for whole day. And suddenly getting below error logs without changing any code.Duplicate dependencies are showing in app. Also tried to get tree structure of all used libraries in app.
Duplicate class com.google.android.aidl.BaseProxy found in modules jetified-google-pay-client-api-1.0.0-runtime.jar (google-pay-client-api-1.0.0.aar) and jetified-installreferrer-1.1-runtime.jar (com.android.installreferrer:installreferrer:1.1)
Duplicate class com.google.android.aidl.BaseStub found in modules jetified-google-pay-client-api-1.0.0-runtime.jar (google-pay-client-api-1.0.0.aar) and jetified-installreferrer-1.1-runtime.jar (com.android.installreferrer:installreferrer:1.1)
Duplicate class com.google.android.aidl.Codecs found in modules jetified-google-pay-client-api-1.0.0-runtime.jar (google-pay-client-api-1.0.0.aar) and jetified-installreferrer-1.1-runtime.jar (com.android.installreferrer:installreferrer:1.1)
Duplicate class com.google.android.aidl.TransactionInterceptor found in modules jetified-google-pay-client-api-1.0.0-runtime.jar (google-pay-client-api-1.0.0.aar) and jetified-installreferrer-1.1-runtime.jar (com.android.installreferrer:installreferrer:1.1)
Below are the dependencies in my app level gradle file.
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:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7: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'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.picasso:picasso:2.71828' //Loading Image
implementation 'com.android.volley:volley:1.1.1'
implementation 'pro.appus:zoom-splash:1.0.0'//--------------Splash Animator---------------------
implementation 'com.flaviofaria:kenburnsview:1.0.7'
implementation 'com.facebook.android:facebook-login:[5,6)' //------Facebook Integration---------
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.chabbal:slidingdotsplash:1.0.2'
//---------------Circular ImageView------------------------
implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
//---------------------Crop Library------------------------
implementation 'com.oginotihiro:cropview:1.0.0'
//-------------For Video Upload --------------------------
implementation 'com.squareup.retrofit2:retrofit:2.7.0'
implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
// reactive
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.facebook.stetho:stetho:1.5.1'
implementation 'com.github.worker8:radiogroupplus:v1.0.1'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'me.grantland:autofittextview:0.2.+'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
//-----PayU Money-----------
implementation 'com.payumoney.sdkui:plug-n-play:1.6.0'
implementation 'com.payumoney.core:payumoney-sdk:7.6.0'
//implementation'com.payu.custombrowser:payu-custom-browser:7.5.1'
implementation'com.payu.networking:payu-core-networking:1.1.0'
implementation'com.payu.payuanalytics:payuanalytics:1.1.1'
implementation'com.payu.upisdk:upisdk:1.0.2'
//implementation'com.payumoney.core:payumoney-sdk:7.6.0'
implementation'com.payumoney.graphics:asset-download-sdk:0.5.0'
//------CashFree--------------
implementation files ('libs/cashfreesdk-1.4-release.aar')
implementation files ("libs/google-pay-client-api-1.0.0.aar")
implementation 'com.google.android.gms:play-services-tasks:17.0.0'
implementation 'com.github.rubensousa:gravitysnaphelper:1.5'
//----------------Firebase Implementations------------------------------------------------------
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.github.smarteist:autoimageslider:1.3.2'
//----------------------Vimeo dependencies-------------------
implementation 'com.squareup.okhttp3:okhttp:3.14.4'
}
Spent almost 2 days to resolve these dependency issue, but no success. Any help will be really appreciated.
I also faced the same issue. Please find which library is using install referrer and Kindly update the library.
implementation 'com.android.installreferrer:installreferrer:1.1.1'
I migrated my android Application to AndroidX (From menu Refactor-> Migrate to androidX), Now When I run the application it's working fine but when I try to generate signed .apk file I am getting an error like
Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzcdb.
Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzii.
Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzcms.
Here is the List of dependencies I am using on my application,
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:29.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'
implementation('com.android.support:support-annotations:29.0.0')
implementation "com.android.support:design:29.0.0"
implementation 'com.android.support:support-v4:29.0.0'
implementation "com.google.android.material:material:1.0.0"
implementation 'com.google.android:flexbox:0.3.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'me.relex:circleindicator:1.2.2#aar' //For view pager circle
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.ybq:Android-SpinKit:1.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
implementation('com.squareup.retrofit2:retrofit:2.6.2') {
exclude module: 'okhttp'
}
implementation project(":photoview")
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.android:flexbox:0.3.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1#aar') {
transitive = true;
}
}
This is likely the cause of your problem:
implementation 'com.google.android.gms:play-services:12.0.1'
In fact, this dependency is very out of date. You should actually just remove it completely and let firebase-messaging just pull in what it needs.
If you need to use any specific play-services library, you should use one of the new, more granular ones listed here:
https://developers.google.com/android/guides/releases
I'm getting this strange behavior that I'm not able to import OnSuccessListener to my code after git cloning and building in a different machine (this resolved fine in my previous machine). However the project builds fine and runs on the emulator. But I'm not able to write firebase related codes further as the listener isn't resolving.
I tried cleaning the project, rebuilding, invalidating the cache but still no luck.
Gradle Dependencies,
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
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 'com.google.firebase:firebase-firestore:17.0.4'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'com.android.support:design:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.github.drawers:SpinnerDatePicker:1.0.6'
implementation 'com.github.yalantis:ucrop:2.2.2'
}
Please try adding this into your app-gradle file.
implementation 'com.google.android.gms:play-services-tasks:16.0.1'
What you do is make all the firebase and gms version of the same number like for example:
implementation 'com.google.firebase:firebase-auth:102.0'
implementation 'com.google.android.gms:play-services-auth:10.2.0'