firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.73k stars 3.98k forks source link

🐛 [firebase_core] Could not determine the dependencies of task ':firebase_core:compileDebugAidl'. #11232

Closed rodrigodev-couheartlabs closed 1 year ago

rodrigodev-couheartlabs commented 1 year ago

Bug report

Describe the bug A clear and concise description of what the bug is.

Steps to reproduce

Steps to reproduce the behavior:

  1. Install flutter - https://docs.flutter.dev/get-started/install/linux
  2. Create a project with flutter create <project_name>
  3. Add firebase to the project - https://firebase.google.com/docs/flutter/setup?platform=android
  4. Start the android device emulator - I'm using pixel 6 api 34
  5. Run flutter run

The build will failed with the message:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':firebase_core:compileDebugAidl'.
> javax.xml.bind.UnmarshalException (no error message)

Expected behavior

The android app should run in the emulator

Sample project

Providing a minimal example project which demonstrates the bug in isolation from your main App greatly enhances the chance of a timely fix. Please link to the public repository URL.


Additional context

I'm running in an ubuntu machine

and I already tried to run flutter pub cache repair


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [✓] Flutter (Channel stable, 3.10.5, on Ubuntu 22.04.2 LTS 5.19.0-46-generic, locale en_CA.UTF-8) • Flutter version 3.10.5 on channel stable at /home/rodrigo/snap/flutter/common/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (3 weeks ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3) • Android SDK at /home/rodrigo/Android/Sdk • Platform android-34, build-tools 34.0.0-rc3 • Java binary at: /usr/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+7-Ubuntu-0ubuntu122.04.2) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at google-chrome [✓] Linux toolchain - develop for Linux desktop • clang version 10.0.0-4ubuntu1 • cmake version 3.16.3 • ninja version 1.10.0 • pkg-config version 0.29.1 [✓] Android Studio (version 2022.2) • Android Studio at /home/rodrigo/develop/android-studio • Flutter plugin version 74.0.2 • Dart plugin version 222.4582 • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] IntelliJ IDEA Community Edition (version 2023.1) • IntelliJ at /snap/intellij-idea-community/434 • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code • VS Code at /snap/code/current • Flutter extension version 3.68.0 [✓] Connected device (3 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator) • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.2 LTS 5.19.0-46-generic • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198 [✓] Network resources • All expected network resources are available. • No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 3.0.5 Flutter SDK 3.10.5 testflutter2 1.0.0+1 dependencies: - cupertino_icons 1.0.5 - firebase_core 2.14.0 [firebase_core_platform_interface firebase_core_web flutter meta] - flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine] dev dependencies: - flutter_lints 2.0.2 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection js matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] transitive dependencies: - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - collection 1.17.1 - fake_async 1.3.1 [clock collection] - firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.6.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - js 0.6.7 [meta] - lints 2.1.1 - matcher 0.12.15 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.2.0 - meta 1.9.1 - path 1.8.3 - plugin_platform_interface 2.1.4 [meta] - sky_engine 0.0.99 - source_span 1.9.1 [collection path term_glyph] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.5.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - vector_math 2.1.4 ```

danagbemava-nc commented 1 year ago

Hi @rodrigodev-couheartlabs, please provide the following

I followed the steps you outlined above, but I could not reproduce the issue.

rodrigodev-couheartlabs commented 1 year ago

Hi @danagbemava-nc

I'm running in an ubuntu 22.04.2 LTS machine and I downloaded the Android SDK from here

After some investigation I've found a empty package.xml inside the folder Android/Sdk/platforms/android-31 after delete this file, the error changed to this one here:

flutter_run_v_after_remove_empty_package.txt

Using hardware rendering with device sdk gphone64 x86 64. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mapDebugSourceSetPaths'.
> Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths'
   > Failed to calculate the value of task ':app:mapDebugSourceSetPaths' property 'extraGeneratedResDir'.
      > Querying the mapped value of provider(java.util.Set) before task ':app:processDebugGoogleServices' has completed is not supported

* 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 5s
Running Gradle task 'assembleDebug'...                              6.0s
Exception: Gradle task assembleDebug failed with exit code 1

* AS YOU REQUESTED, THIS LOG IS BEFORE I REMOVE THE EMPTY PACKAGE.XML

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        // START: FlutterFire Configuration
        classpath 'com.google.gms:google-services:4.3.10'
        // END: FlutterFire Configuration
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}
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'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    namespace "com.couheartlabs.closeneat"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.couheartlabs.closeneat"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        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
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
rodrigodev-couheartlabs commented 1 year ago

@danagbemava-nc

After change the com.google.gms:google-services plugin from 4.3.10 to 4.3.14 it is working!

Do you know why?

danagbemava-nc commented 1 year ago

Hi @rodrigodev-couheartlabs,

After some investigation I've found a empty package.xml inside the folder Android/Sdk/platforms/android-31 after delete this file, the error changed to this one here:

This likely means that the download was not completed for the platform, which would explain why you got the XML issue earlier.

Regarding the gms issue, see this SO thread for more information on why you got the error. https://stackoverflow.com/questions/68180736/org-gradle-api-invalidusercodeexception-querying-the-mapped-value-of-provider

Closing from here as this issue has been resolved.