Flutterfire: ๐Ÿ› [cloud_functions] Cannot build project due to (apparently) missing compileSdkVersion

Created on 7 Oct 2020  ยท  3Comments  ยท  Source: FirebaseExtended/flutterfire

Bug report

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.

Steps to reproduce

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.

Expected behavior

The application should build.


Additional context

None.


Flutter doctor

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!


Flutter dependencies

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:

  • cloud_functions 0.6.0+1 [meta flutter firebase_core cloud_functions_platform_interface cloud_functions_web]
  • firebase_auth 0.18.1+2 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
  • firebase_core 0.5.0+1 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
  • firebase_remote_config 0.4.0+2 [flutter firebase_core]
  • flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
  • flutter_bloc 6.0.6 [flutter bloc provider]
  • flutter_secure_storage 3.3.4 [meta flutter]
  • http 0.12.2 [http_parser path pedantic]
  • image_picker 0.6.7+11 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
  • location 3.0.2 [flutter meta location_platform_interface location_web]
  • mapbox_gl 0.8.0 [flutter mapbox_gl_platform_interface mapbox_gl_web]
  • path_provider 1.6.18 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
  • video_thumbnail 0.2.2 [flutter]

dev dependencies:

  • flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:

  • archive 2.0.13 [crypto args path]
  • args 1.6.0
  • async 2.5.0-nullsafety [collection]
  • bloc 6.0.3 [meta]
  • boolean_selector 2.1.0-nullsafety [source_span string_scanner]
  • characters 1.1.0-nullsafety.2
  • charcode 1.2.0-nullsafety
  • clock 1.1.0-nullsafety
  • cloud_functions_platform_interface 2.0.0 [flutter meta firebase_core plugin_platform_interface]
  • cloud_functions_web 2.0.0 [cloud_functions_platform_interface flutter flutter_web_plugins firebase http_parser meta]
  • collection 1.15.0-nullsafety.2
  • convert 2.1.1 [charcode typed_data]
  • crypto 2.1.5 [collection convert typed_data]
  • fake_async 1.1.0-nullsafety [clock collection]
  • ffi 0.1.3
  • file 5.2.1 [intl meta path]
  • firebase 7.3.0 [http http_parser js]
  • firebase_auth_platform_interface 2.1.1 [flutter meta firebase_core plugin_platform_interface]
  • firebase_auth_web 0.3.1+1 [flutter flutter_web_plugins firebase meta http_parser intl firebase_core firebase_auth_platform_interface js]
  • firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
  • firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
  • flutter_plugin_android_lifecycle 1.0.11 [flutter]
  • flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
  • http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
  • image 2.1.18 [archive xml meta]
  • image_picker_platform_interface 1.1.1 [flutter meta http plugin_platform_interface]
  • intl 0.16.1 [path]
  • js 0.6.2
  • location_platform_interface 1.0.0 [flutter meta plugin_platform_interface]
  • location_web 1.0.0 [flutter flutter_web_plugins location_platform_interface http_parser meta js]
  • mapbox_gl_dart 0.1.5 [js meta]
  • mapbox_gl_platform_interface 0.8.0 [flutter meta]
  • mapbox_gl_web 0.8.0 [flutter flutter_web_plugins meta mapbox_gl_platform_interface mapbox_gl_dart image]
  • matcher 0.12.10-nullsafety [stack_trace]
  • meta 1.3.0-nullsafety.2
  • nested 0.0.4 [flutter]
  • path 1.8.0-nullsafety
  • path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
  • path_provider_macos 0.0.4+4 [flutter]
  • path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface]
  • path_provider_windows 0.0.4+1 [path_provider_platform_interface meta path flutter ffi win32]
  • pedantic 1.9.2 [meta]
  • petitparser 3.1.0 [meta]
  • platform 2.2.1
  • plugin_platform_interface 1.0.3 [meta]
  • process 3.0.13 [file intl meta path platform]
  • provider 4.3.2+2 [flutter nested collection]
  • quiver 2.1.3 [matcher meta]
  • sky_engine 0.0.99
  • source_span 1.8.0-nullsafety [charcode collection path term_glyph]
  • stack_trace 1.10.0-nullsafety [path]
  • stream_channel 2.1.0-nullsafety [async]
  • string_scanner 1.1.0-nullsafety [charcode source_span]
  • term_glyph 1.2.0-nullsafety
  • test_api 0.2.19-nullsafety [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
  • typed_data 1.3.0-nullsafety.2 [collection]
  • vector_math 2.1.0-nullsafety.2
  • win32 1.7.3 [ffi]
  • xdg_directories 0.1.2 [meta path process]
  • xml 4.5.1 [collection convert meta petitparser]```


Needs Attention bug

Most helpful comment

+1 same problem here, any updates?

All 3 comments

+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:

  1. In the android/build.gradle revert to classpath 'com.android.tools.build:gradle:3.5.0'
  2. In the android/gradle/wrapper/gradle-wrapper.properties modify distributionUrl to distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
  3. In the android/app/build.gradle upgrade the compile and target SDK versions to 29

Upon 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.

Was this page helpful?
0 / 5 - 0 ratings