Flutter: upgrading firebase_ml_vision dependency from 0.9.x to 0.10.0

389 views Asked by At

My flutter project runs fine with Firebase ML Vision 0.9.x, if I try to upgrade to 0.10.0 (or higher), it yields the following errors:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\...\Cache\hosted\pub.dartlang.org\firebase_ml_vision-0.10.0\android\build.gradle' line: 26

* What went wrong:
A problem occurred evaluating project ':firebase_ml_vision'.
> Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':firebase_ml_vision'.
> compileSdkVersion is not specified. Please add it to build.gradle

* 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 889ms
Exception: Gradle task assembleDebug failed with exit code 1

The first of those two errors is weird because the setup instructions and the package install guidelines both say that firebase_core is not required (anymore).

The second is just plain wrong, as my app's build.gradle specifies compileSdkVersion 30 and the firebase_ml_vision package's build.gradle specifies compileSdkVersion 29.

Any ideas what's going on?

1

There are 1 answers

0
rgisi On BEST ANSWER

Found a solution that works: Ignore the setup instructions and add firebase_core as a dependency. Then, add the 'implementations' according to this thread to solve the 'Duplicate class' issues.