Uses outdated version of Firebase ML so not compatible with newer versions of firebase services
shoaibomar opened this issue · 24 comments
Running Gradle task 'assembleDebug'...
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.zze found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzf found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzg found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzh found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzi found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzv found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzw found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
-
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. -
Get more help at https://help.gradle.org
BUILD FAILED in 41s
Exception: Gradle task assembleDebug failed with exit code 1
is there any workaround for this
I'm having this same issue right now.
I am also facing the same issue.
I haven't had time to do a full test and push a new version but try using the 'use-mlkit' branch. I'd appreciate any feedback, and I do plan on releasing it as a new version when I have time.
@rmtmckenzie i think the mlkit barcode dependency 16.0.0 in the build.gradle is causing some firebase issues and needs to be updated to a newer version
@Manuel-Indlekofer I bumped it to 16.0.3. I've been building just fine though and I'm using a few firebase dependencies. It might be worth doing a flutter clean in case old firebase dependencies are still hanging around for some reason. If not, attach the results of ./gradlew dependencies
from the android folder here and I can take a look.
@rmtmckenzie Hi, thanks in advance for investigating this issue! Cleaning does not work the occuring error is exatly the one described by
Running Gradle task 'assembleDebug'...
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.zze found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzf found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzg found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzh found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzi found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzv found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzw found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org
BUILD FAILED in 41s
Exception: Gradle task assembleDebug failed with exit code 1
Just looking at your dependencies, I'm not seeing com.google.mlkit:barcode-scanning at all, which makes me think you must still be hooked up to the old version.
Does your pubspec look something like this? If you're missing the dependency_overrides
section add it.
dependencies:
qr_mobile_vision: '1.0.2'
....
dependency_overrides:
qr_mobile_vision:
git:
url: https://github.com/rmtmckenzie/flutter_qr_mobile_vision.git
ref: 'use-mlkit'
When you flutter pub get
you should see a message saying something like this:
Warning: You are using these overridden dependencies:
! qr_mobile_vision 1.0.2 from git https://github.com/rmtmckenzie/flutter_qr_mobile_vision.git at 736c91
In particular check that the commit is 736c91 as that's what includes the changes that I've been using on android.
I will try to update the pub dependency soon, I just really won't have time until at least thursday.
I can reproduce this issue in a brand new sample flutter project by utilizing these dependencies:
In Pubspec:
qr_mobile_vision: ^1.0.2
firebase_core: ^0.5.1
firebase_crashlytics: ^0.2.2
firebase_messaging: ^7.0.3
firebase_analytics: ^6.1.0
firebase_in_app_messaging: ^0.2.1
in build.gradle:
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
in app/build.gradle:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
This yields once again:
Execution failed for task ':app:checkDebugDuplicateClasses'.
1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.vision.zze found in modules play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
I'm perfectly aware that there's an issue with qr_mobile_vision 1.0.2, and plan on releasing a version that fixes it soon. I've outlined the way that you can test that fix immediately - using the dependency override to use the git repository directly as I wrote in my last post and the one before it.
Thx, i am using this fix currently. I just listed my dependencies because of your reply:
Just looking at your dependencies, I'm not seeing com.google.mlkit:barcode-scanning at all, which makes me think you must >still be hooked up to the old version.
Hi thanks a lot for the update, I tried using the use-mlkit branch and everything seems to be working fine 💥
Any update on this?
Just looking at your dependencies, I'm not seeing com.google.mlkit:barcode-scanning at all, which makes me think you must still be hooked up to the old version.
Does your pubspec look something like this? If you're missing the
dependency_overrides
section add it.dependencies: qr_mobile_vision: '1.0.2' .... dependency_overrides: qr_mobile_vision: git: url: https://github.com/rmtmckenzie/flutter_qr_mobile_vision.git ref: 'use-mlkit'When you
flutter pub get
you should see a message saying something like this:Warning: You are using these overridden dependencies: ! qr_mobile_vision 1.0.2 from git https://github.com/rmtmckenzie/flutter_qr_mobile_vision.git at 736c91
In particular check that the commit is 736c91 as that's what includes the changes that I've been using on android.
I will try to update the pub dependency soon, I just really won't have time until at least thursday.
Thanks @rmtmckenzie for the plugin. The use-mlkit
branch works nice for Android but the build fails for iOS. It seems to be similar to #96 . Below you can find my logs:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MLKBarcode", referenced from:
objc-class-ref in qr_mobile_vision(QrReader.o)
"_OBJC_CLASS_$_MLKBarcodeScanner", referenced from:
objc-class-ref in qr_mobile_vision(QrReader.o)
"_OBJC_CLASS_$_MLKVisionImage", referenced from:
objc-class-ref in qr_mobile_vision(QrReader.o)
"_OBJC_CLASS_$_MLKBarcodeScannerOptions", referenced from:
objc-class-ref in qr_mobile_vision(SwiftQrMobileVisionPlugin.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
sry all, I'm going to try to take a look at this this weekend - I should finally have a bit of time!
But re: the no symbols found for armv7 - the MLKit library doesn't support armv7 according to this.
I'm also stuck on this issue right now.
I've pushed an update to the MLKit - can anyone try testing it out? It sounds like 32 bit will never be supported by MLKIT, so if that's something you need then you may need to revert to using an older version of this plugin.
I've updated the podfile to specify this, and the demo project builds just fine for me. If someone could confirm whether this has solved the problem that'd be great =).
If not I might need to just make it so that you have to specify 64 bit only for your build, or change support to iOS 11+ (as there is no 32-bit in 11 onwards)
I've pushed an update to the MLKit - can anyone try testing it out? It sounds like 32 bit will never be supported by MLKIT, so if that's something you need then you may need to revert to using an older version of this plugin.
I've updated the podfile to specify this, and the demo project builds just fine for me. If someone could confirm whether this has solved the problem that'd be great =).
If not I might need just make not that you have to specify 64 bit only for your build, or change support to iOS 11+ (as there is no 32-bit in 11 onwards)
I verified the changes and the build still fails for iOS.
Flutter 1.24.0-10.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 022b333a08 (4 weeks ago) • 2020-11-18 11:35:09 -0800
Engine • revision 07c1eed46b
Tools • Dart 2.12.0 (build 2.12.0-29.10.beta)
ld: warning: ignoring file /Users/istvan/Fluttech/Projects/external/hyll-mobile/build/ios/Release-iphoneos/qr_mobile_vision/qr_mobile_vision.framework/qr_mobile_vision, building for iOS-armv7 but attempting to link with file built for
iOS-arm64
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_QrMobileVisionPlugin", referenced from:
objc-class-ref in GeneratedPluginRegistrant.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
You may need to update the Architectures to amd64 only. I posted this on another plugin:
okay thanks guys. The simple solution is to require iOS 11. As soon as you set the build to 11 it should just work. I'm going to set the podspec to ask for iOS 11 and write an explanation into the readme.
If you need to target before iOS 11, that's fine - you'll just have to make sure you have your build architectures set to just arm64 (i.e. ARCHS_STANDARD_64_BIT)... but you will be missing out on targeting older device that only run 32 bit.
I guess anyone who needs 32 bit will have to adapt an older version of the library that doesn't use MLKit.
Thanks @rmtmckenzie , with the latest use-mlkit
branch I get the following error on Android.
This worked before. Is there something I can do on my end ?
W/cgr.qrmv.QrDetector(13445): Barcode Reading Failure:
W/cgr.qrmv.QrDetector(13445): com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@17.0.0:32)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.zzl.run(Unknown Source:10)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.zzp.run(com.google.mlkit:common@@17.0.0:3)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@17.0.0:24)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(com.google.mlkit:common@@17.0.0:30)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.zzh.run(Unknown Source:2)
W/cgr.qrmv.QrDetector(13445): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/cgr.qrmv.QrDetector(13445): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/cgr.qrmv.QrDetector(13445): at java.lang.Thread.run(Thread.java:919)
W/cgr.qrmv.QrDetector(13445): Caused by: java.lang.IllegalStateException: Image is already closed
W/cgr.qrmv.QrDetector(13445): at android.media.Image.throwISEIfImageIsInvalid(Image.java:72)
W/cgr.qrmv.QrDetector(13445): at android.media.ImageReader$SurfaceImage$SurfacePlane.getBuffer(ImageReader.java:965)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.vision.barcode.internal.zzf.zza(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.1.2:72)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.vision.barcode.internal.zzf.zzb(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.1.2:83)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.vision.barcode.internal.zzf.run(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.1.2:143)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@16.1.0:23)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.vision.common.internal.zzc.call(Unknown Source:4)
W/cgr.qrmv.QrDetector(13445): at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@17.0.0:29)
Seems to be working for me building on both iOS and Android. iOS is scanning barcodes fine, but Android seems to not actually pick up barcodes.
@GyuriMajercsik hmmm I integrated a change someone had made to fix a crash on android 6 with the image not being closed properly, but apparently that has introduced something new. I'll give it a test on a few more devices...
Okay fixed and published as 2.0! =)