Describe the bug
I'm having troubles building the Flutter application which uses the cloud_functions plugin, among others. The problem is that the building process for Android fails with error messages that I do not understand; I cannot see anything being wrong in my configuration.
At the moment, my Firebase dependencies are
dependencies:
flutter:
sdk: flutter
# Firebase
firebase_core: ^0.5.0
firebase_auth: ^0.18.1+1
cloud_functions: ^0.6.0+1
firebase_remote_config: ^0.4.0+2
I've run flutter clean and flutter pub get, but once I try to build the app, the following trace occurs:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/usr/local/Caskroom/flutter/1.20.2/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions-0.6.0+1/android/build.gradle' line: 26
* What went wrong:
A problem occurred evaluating root project 'cloud_functions'.
> 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 root project 'cloud_functions'.
> compileSdkVersion is not specified.
* 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 535ms
Exception: The plugin cloud_functions could not be built due to the issue above.
For the first exception, it should be evident, that the firebase_core package is mentioned. For the second exception, I'm pasting the redacted excerpt of build.gradle file:
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "XXX.XXX.XXX"
minSdkVersion 23
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
Evidently, compileSdkVersion is present.
The application should build.
None.
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[โ] Flutter (Channel beta, 1.22.0-12.1.pre, on Mac OS X 10.15.7 19H2, locale en-SI)
[โ] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[โ] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[โ] Chrome - develop for the web
[โ] Android Studio (version 4.0)
[โ] VS Code (version 1.49.3)
[โ] Connected device (3 available)
โข No issues found!
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
```
Dart SDK 2.10.0-110.3.beta
Flutter SDK 1.22.0-12.1.pre
mmunicipality 0.0.1+1
dependencies:
dev dependencies:
transitive dependencies:
+1 same problem here, any updates?
Update: the problem in my case was with versioning. I pulled the clean project from the repository, and made the following changes:
android/build.gradle revert to classpath 'com.android.tools.build:gradle:3.5.0'android/gradle/wrapper/gradle-wrapper.properties modify distributionUrl to distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zipandroid/app/build.gradle upgrade the compile and target SDK versions to 29Upon making these changes, running flutter clean && flutter pub get, the issue got resolved.
In my case this changes do not work.
I was able to fixed downgrading the flutter version to 1.20.3 specifically. Just in case anyone needs this piece of information.
Most helpful comment
+1 same problem here, any updates?