Describe the bug
after adding firebase_ml_vision 0.9.9 app not builds and says Duplicate class com.google.android.gms.internal.vision.zzbu found in modules jetified-play-services-vision-common-19.1.2-runtime (com.google.android.gms:play-services-vision-common:19.1.2) 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)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.android.gms.internal.vision.zzbu found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbv found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzdt found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkq found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkr found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzks found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkt found in modules jetified-play-services-vision-common-19.1.2-runt
ime (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-r
untime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzs found in modules jetified-play-services-vision-common-19.1.2-runti
me (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-ru
ntime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzt found in modules jetified-play-services-vision-common-19.1.2-runti
me (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-ru
ntime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzu found in modules jetified-play-services-vision-common-19.1.2-runti
me (com.google.android.gms:play-services-vision-common:19.1.2) and jetified-play-services-vision-image-labeling-internal-16.0.0-ru
ntime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution error
s</a>.
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[โ] Flutter (Channel stable, 1.22.1, on Microsoft Windows [Version 10.0.18362.476], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[โ] Android Studio (version 4.0)
[โ] VS Code, 64-bit edition (version 1.49.0)
[โ] Connected device (1 available)
! Doctor found issues in 1 category.
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
PASTE OUTPUT INSIDE HERE
Hi @DauntlessMahmud
Could you please fill out the entire issue form and also provide the contents of your android/app/build.gradle?
Thank you
Thank you sir @markusaksli-nc ,
this was my gradle file
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location
with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "com.asif.label_app"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run
--release` works.
signingConfig signingConfigs.debug
}
}
dependencies {
api 'com.google.firebase:firebase-ml-vision-image-label-model:20.0.2'
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
implementation 'com.google.android.gms:play-services-vision:20.1.2'
implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.2'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
On Wed, Nov 18, 2020 at 3:08 PM Nikita Kastyrya notifications@github.com
wrote:
Check this
https://firebase.google.com/support/release-notes/android#bom_v25-8-0โ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/FirebaseExtended/flutterfire/issues/4141#issuecomment-729540900,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AG3BJOJMZ4GOTAZ4T5KYQALSQOFI3ANCNFSM4TZDMSKA
.
Then you also need to include
implementation 'com.google.android.gms:play-services-vision:20.1.1'
implementation 'com.google.android.gms:play-services-vision-common:19.1.1'
in your gradle dependencies.
Does this solve the issue for you?
Then you also need to include
implementation 'com.google.android.gms:play-services-vision:20.1.1' implementation 'com.google.android.gms:play-services-vision-common:19.1.1'in your gradle dependencies.
Does this solve the issue for you?
no i have the same issue .. it's error in firebase_core package from version 0.5.1 to 0.5.2 , but before these versions everything is perfect ...
@imeDevelopers did it work on your project? I haven't figured out the problem yet. have you any solution?
@imeDevelopers did it work on your project? I haven't figured out the problem yet. have you any solution?
yes but i dont use ml vision ..
i adjusted the dependencies to firebase core 0.5.0+1 and my app worked ..
add your dependencies or pubspec.yaml file here so i can help you ..
because i Dont know Which packages do you use ..
@imeDevelopers
Here is my Project Source . Can you check it please?
do you only use firebase core and machine learning vision in your dependencies ?
if this is true you should use earlier version of your machine learning vision package and it should work ..
if you use more packages in your dependencies , so you make it hard on yourself and us .. here we cant help you if you hide some information that can help us to solve your problem ..
i have no time to check and try your not real code ..
@imeDevelopers
i didn't use more package , i used only which i need...
pubspec.yaml
name: label_app
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
path_provider: ^1.6.24
firebase_ml_vision: ^0.9.9
firebase_core: ^0.5.0
cupertino_icons: ^1.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/pen.jpg
- assets/table.jpg
app\build.gradle
`def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.asif.label_app"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
dependencies {
api 'com.google.firebase:firebase-ml-vision-image-label-model:20.0.2'
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-vision:20.1.1'
implementation 'com.google.android.gms:play-services-vision-common:19.1.1'
implementation 'com.google.firebase:firebase-ml-vision-image-label-model:20.0.2'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
`
I have the same problem, my pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
logger: ^0.8.3
flutter_spinkit: ^4.1.1
flutter_blue: ^0.7.1+1
connectivity: ^0.4.8+2
rxdart: ^0.23.0
shared_preferences: ^0.5.12
flutter_secure_storage: ^3.3.3
firebase_core: ^0.5.2
firebase_auth: ^0.18.3
google_sign_in: ^4.1.1
cloud_firestore: ^0.14.3
provider: ^4.3.2+2
syncfusion_flutter_charts: ^18.3.48+1
intl: ^0.16.1
flutter_svg: ^0.18.0
@toyokomi
firebase_core: 0.5.0+1
firebase_auth: 0.18.1+1
cloud_firestore: 0.14.1+3
@DauntlessMahmud
use firebase_core: 0.5.0+1 version and see what is the compatible firebase_ml_vision version with that version ..
when you run your get packages command wait to the end and watch the output window in your command line and you will know the compatible firebase_ml_vision version with this firebase_core version ...
i am sure it will work ..
@toyokomi
@DauntlessMahmud
be sure your compileSdkVersion is set to 29
@DauntlessMahmud
i think you shoud use this version
firebase_ml_vision: 0.9.6+3
clean your project and run get packages again ..
open your project in android studio and remove unused resources ..
and search for duplicated classes and remove it and close the android studio and run get packages again ...
@imeDevelopers
i tried but it does not work

my used package

CompileSDK version

my used Defendency

i can't understand which one is unused resource , which i have to remove
Please run command
gradle app:dependencies and check which package od duplicating definitions. For me it has was flutter_blue. Then try to change this package a little version up or down, not so pro but still it has been working for me. Good luck!
@DauntlessMahmud
change the implementation in gradle.build file to be compatible with this version of firebase_ml_vision
try to don't use latest versions of anything ..
use only the stable versions ..
@DauntlessMahmud
Refactor -> remove un used resources ..
look inside external libraries for duplicated classes ..
https://stackoverflow.com/questions/36990054/android-studio-resolving-duplicate-classes
https://developer.android.com/studio/build/dependencies#resolution_errors
https://developer.android.com/studio/build/dependencies#duplicate_classes
Hey @DauntlessMahmud. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
anyone found working versions for firebase_core and firebase_ml_vision ?
the latest ones dont work, firebase_core: 0.5.0+1, firebase_ml_vision: 0.9.6+3 doesn't work either
I was able to solve this issue about duplicate classes following these instructions.
// android/app/build.gradle > dependencies
implementation 'com.google.android.gms:play-services-vision:20.1.1'
implementation 'com.google.android.gms:play-services-vision-common:19.1.1'
In addition:
// android/build.gradle > buildscript > dependencies
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
}
I'm using these specific/locked versions of the plugins (no ^):
firebase_core: 0.5.2+1
firebase_ml_vision: 0.9.9
There are new versions of some Firebase plugins but I haven't checked them.
@arthurdenner and com.google.gms:google-services version ?
i got this with com.google.gms:google-services:4.3.4 same issue with 4.3.0
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.1.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-vision-image-label:18.0.4 -> com.google.android.gms:play-servic
es-vision-common@[19.1.0], but play-services-vision-common version was 19.1.1.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision@{strictly 24.1.0}
-- Project 'app' depends on project 'firebase_ml_vision' which depends onto com.google.firebase:[email protected].
0
-- Project 'app' depends onto com.google.android.gms:play-services-vision-common@{strictly 19.1.1}
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.android.gms:play-services-vision-image-label@{strictly 18.0.4}
-- Project 'app' depends onto com.google.android.gms:play-services-vision@{strictly 20.1.1}
@satyajitghana, I'm using classpath 'com.google.gms:google-services:4.3.3'.
// android/build.gradle > buildscript > dependencies
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
}
@arthurdenner
something feels wrong, I've updated all the version as per yours, did a clean build a few times, still the same issue
Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.google.android.gms, artifactId=play-services-vision-image-label, version=18.0.4), toArtifact=Artifact(groupId=com.google.andr
oid.gms, artifactId=play-services-vision-common), toArtifactVersionString=[19.1.0])
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.1.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-vision-image-label:18.0.4 -> com.google.android.gms:play-servic
es-vision-common@[19.1.0], but play-services-vision-common version was 19.1.1.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision@{strictly 24.1.0}
-- Project 'app' depends on project 'firebase_ml_vision' which depends onto com.google.firebase:[email protected].
0
-- Project 'app' depends onto com.google.android.gms:play-services-vision-common@{strictly 19.1.1}
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.android.gms:play-services-vision-image-label@{strictly 18.0.4}
-- Project 'app' depends onto com.google.android.gms:play-services-vision@{strictly 20.1.1}
@satyajitghana I noticed you're using image-label. Make sure you've applied the fix for it too - check the link in my comment above.
If that doesn't help to fix it, unfortunately I don't have any other suggestions. I'm not very familiar with native Android development myself and the changes I mentioned were enough to solve it for me. :/
@arthurdenner not using image label, not sure why it's showing up there, i'm trying to use FaceDetector in flutter FirebaseVision.instance.faceDetector
@DauntlessMahmud @satyajitghana Does this work for you?
pubspec.yaml
firebase_core: ^0.5.3
firebase_ml_vision: ^0.9.10
app/build.gradle
dependencies{
api 'com.google.android.gms:play-services-vision:20.1.2'
api 'com.google.android.gms:play-services-vision-common:19.1.2'
api 'com.google.firebase:firebase-ml-vision-image-label-model:20.0.2'
api 'com.google.android.gms:play-services-vision-image-labeling-internal:16.0.5'
api 'com.google.firebase:firebase-ml-vision-face-model:20.0.2'
api 'com.google.android.gms:play-services-vision-face-contour-internal:16.0.3'
api 'com.google.android.gms:play-services-vision-image-label:18.1.0'
}
@markusaksli-nc yes that worked ! thanks !!! :)
even this works
pubspec.yaml
firebase_core: ^0.5.3
firebase_ml_vision: ^0.9.10
@markusaksli-nc
thank u sir, finally it's woking well
Thank you, closing this as solved based on your last comments.
Most helpful comment
@DauntlessMahmud @satyajitghana Does this work for you?
pubspec.yamlapp/build.gradle