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.6k stars 3.95k forks source link

πŸ› [firebase_auth] MissingPluginException(No implementation found for method listen on channel plugins.flutter.io/firebase_auth/id-token/[DEFAULT]) #7191

Closed jangruenwaldt closed 2 years ago

jangruenwaldt commented 2 years ago

Bug report

Describe the bug Exception being thrown that makes plugin unable to function

Steps to reproduce

Steps to reproduce the behavior:

Launch the app which uses FirebaseAuth.instance.authStateChanges() and observe eventually this exception

Expected behavior

No exception

Sample project

Can not reliably reproduce this, so hard to do.

Additional context

-

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 stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale en-DE) [βœ“] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [βœ“] Xcode - develop for iOS and macOS [βœ“] Chrome - develop for the web [βœ“] Android Studio (version 2020.3) [βœ“] Android Studio (version 2020.3) [βœ“] Android Studio (version 2020.3) [βœ“] IntelliJ IDEA Ultimate Edition (version 2021.2.2) [βœ“] IntelliJ IDEA Ultimate Edition (version 2021.2.2) [βœ“] IntelliJ IDEA Ultimate Edition (version 2021.2.1) [βœ“] Connected device (2 available) β€’ No issues found! ```

Flutter dependencies

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

Click To Expand ``` Dart SDK 2.14.4 Flutter SDK 2.5.3 ourflat 1.4.1+195 dependencies: - app_settings 4.1.1 [flutter] - badges 2.0.1 [flutter] - cached_network_image 3.1.0 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - cloud_firestore 2.5.3 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_functions 3.0.4 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - connectivity_plus 2.0.2 [flutter meta connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows] - countup 0.1.3 [flutter] - decimal 1.3.0 [rational] - equatable 2.0.3 [collection meta] - eraser 2.0.0 [flutter] - firebase_analytics 8.3.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta] - firebase_auth 3.1.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 1.7.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.2.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_dynamic_links 2.0.10 [firebase_core flutter] - firebase_messaging 10.0.8 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_performance 0.7.1+1 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter] - firebase_remote_config 0.11.0+1 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface flutter] - firebase_storage 10.0.5 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_bloc 7.3.1 [flutter bloc provider] - flutter_chat_ui 1.0.5 [flutter flutter_chat_types flutter_link_previewer intl path_provider uuid path] - flutter_facebook_auth 3.5.2 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web] - flutter_keyboard_visibility 5.1.0 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter] - flutter_linkify 5.0.2 [flutter linkify] - flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math] - flutter_native_timezone 2.0.0 [flutter_web_plugins flutter js] - flutter_page_transition 0.1.6 [flutter] - flutter_rounded_date_picker 2.0.0 [flutter] - flutter_svg 0.23.0+1 [flutter meta path_drawing vector_math xml] - get_it 7.2.0 [async collection] - google_fonts 2.1.0 [flutter http path_provider crypto] - google_sign_in 5.1.1 [flutter google_sign_in_platform_interface google_sign_in_web meta] - image_cropper 1.4.1 [flutter] - image_picker 0.8.4+2 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface] - in_app_review 2.0.3 [flutter in_app_review_platform_interface] - keep_keyboard_popup_menu 2.0.5 [flutter flutter_keyboard_visibility] - memoize 3.0.0 - native_admob_flutter 1.5.0 [flutter] - package_info_plus 1.3.0 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web] - path 1.8.0 - path_provider 2.0.5 [flutter path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - pref 2.4.0 [flutter logging shared_preferences] - preload_page_view 0.1.6 [flutter] - purchases_flutter 3.4.6 [flutter collection] - receive_sharing_intent 1.4.5 [flutter] - rxdart 0.27.2 - scrollable_positioned_list 0.2.2 [flutter collection] - share_plus 3.0.4 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web] - sign_in_with_apple 3.2.0 [flutter meta] - smooth_star_rating 2.0.0 [flutter] - sticky_headers 0.2.0 [flutter] - table_calendar 3.0.2 [flutter intl simple_gesture_detector] - url_launcher 6.0.12 [flutter meta url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - uuid 3.0.5 [crypto] - version 2.0.0 dev dependencies: - build_runner 2.1.4 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - dart_code_metrics 4.4.0 [analyzer analyzer_plugin ansicolor args collection crypto file glob html meta path source_span yaml] - flutter_lints 1.0.4 [lints] - 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] - integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service archive async boolean_selector characters charcode clock collection crypto fake_async file matcher meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math webdriver] - intl_utils 2.4.0 [analyzer archive args dart_style http intl path petitparser yaml] - mockito 5.0.16 [analyzer build code_builder collection dart_style matcher meta path source_gen test_api] - screenshots 2.2.0 [args yaml resource_portable path file archive platform process meta intl tool_mobile] - test 1.17.10 [analyzer async boolean_selector collection coverage http_multi_server io js node_preamble package_config path pedantic pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core] transitive dependencies: - _fe_analyzer_shared 26.0.0 [meta] - analyzer 2.3.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml pedantic] - analyzer_plugin 0.7.0 [analyzer collection dart_style pub_semver yaml] - ansicolor 2.0.1 - archive 3.1.2 [crypto path] - args 2.3.0 - async 2.8.1 [collection meta] - bloc 7.2.1 [meta] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.1.1 [analyzer async convert crypto glob logging meta path] - build_config 1.0.0 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 3.0.1 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.0.4 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml] - build_runner_core 7.2.2 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.1.2 [built_collection collection fixnum meta] - cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.1.0 - charcode 1.3.1 - checked_yaml 2.0.1 [json_annotation source_span yaml] - cli_util 0.3.5 [meta path] - clock 1.1.0 - cloud_firestore_platform_interface 5.4.2 [collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 2.4.3 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - cloud_functions_platform_interface 5.0.11 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.0.13 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.1.0 [built_collection built_value collection matcher meta] - collection 1.15.0 - connectivity_plus_linux 1.1.0 [flutter connectivity_plus_platform_interface dbus meta nm] - connectivity_plus_macos 1.2.1 [connectivity_plus_platform_interface flutter] - connectivity_plus_platform_interface 1.1.0 [flutter meta plugin_platform_interface] - connectivity_plus_web 1.1.0+1 [connectivity_plus_platform_interface flutter_web_plugins flutter] - connectivity_plus_windows 1.2.0 [connectivity_plus_platform_interface flutter] - convert 3.0.1 [typed_data] - coverage 1.0.3 [args logging package_config path source_maps stack_trace vm_service] - cross_file 0.3.1+5 [flutter meta] - crypto 3.0.1 [collection typed_data] - csslib 0.17.1 [source_span] - dart_style 2.2.0 [analyzer args path pub_semver source_span] - dbus 0.5.6 [args ffi meta pedantic xml] - fake_async 1.2.0 [clock collection] - ffi 1.1.2 - file 6.1.2 [meta path] - firebase 9.0.2 [http http_parser js] - firebase_analytics_platform_interface 2.0.1 [flutter meta] - firebase_analytics_web 0.3.0+1 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta] - firebase_auth_platform_interface 6.1.1 [firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 3.1.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.1.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.1.3 [collection firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 3.0.6 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 2.0.6 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_performance_platform_interface 0.0.1+4 [firebase_core flutter plugin_platform_interface] - firebase_performance_web 0.0.1+1 [firebase firebase_performance_platform_interface flutter flutter_web_plugins] - firebase_remote_config_platform_interface 0.3.0+6 [firebase_core flutter meta plugin_platform_interface] - firebase_storage_platform_interface 4.0.3 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.0.3 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - fixnum 1.0.0 - flutter_blurhash 0.6.0 [flutter meta pedantic] - flutter_cache_manager 3.1.2 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid] - flutter_chat_types 2.1.2 [cloud_firestore equatable meta] - flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver archive async boolean_selector characters charcode clock collection crypto matcher platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math] - flutter_facebook_auth_platform_interface 2.7.0 [flutter plugin_platform_interface] - flutter_facebook_auth_web 2.6.0+2 [flutter flutter_web_plugins js flutter_facebook_auth_platform_interface] - flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter] - flutter_link_previewer 2.0.7 [flutter flutter_chat_types flutter_linkify html http linkify meta url_launcher] - flutter_plugin_android_lifecycle 2.0.3 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math] - frontend_server_client 2.1.2 [async path] - fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform] - glob 2.0.2 [async collection file path string_scanner] - google_sign_in_platform_interface 2.1.0 [flutter meta quiver] - google_sign_in_web 0.10.0+3 [flutter flutter_web_plugins google_sign_in_platform_interface js meta] - graphs 2.1.0 [collection] - html 0.15.0 [csslib source_span] - http 0.13.4 [async http_parser meta path] - http_multi_server 3.0.1 [async] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image_picker_for_web 2.1.3 [flutter flutter_web_plugins image_picker_platform_interface meta] - image_picker_platform_interface 2.4.1 [flutter http meta plugin_platform_interface cross_file] - in_app_review_platform_interface 2.0.2 [flutter url_launcher plugin_platform_interface platform] - intl 0.17.0 [clock path] - io 1.0.3 [meta path string_scanner] - js 0.6.3 - json_annotation 4.3.0 [meta] - linkify 4.1.0 - lints 1.0.1 - logging 1.0.2 - matcher 0.12.10 [stack_trace] - meta 1.7.0 - mime 1.0.0 - nested 1.0.0 [flutter] - nm 0.3.0 [dbus] - node_preamble 2.0.1 - octo_image 1.0.0+1 [flutter flutter_blurhash] - package_config 2.0.2 [path] - package_info_plus_linux 1.0.3 [package_info_plus_platform_interface flutter path] - package_info_plus_macos 1.3.0 [flutter] - package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface] - package_info_plus_web 1.0.4 [flutter flutter_web_plugins http meta package_info_plus_platform_interface] - package_info_plus_windows 1.0.4 [package_info_plus_platform_interface ffi flutter win32] - path_drawing 0.5.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.2.1 [vector_math meta] - path_provider_linux 2.1.0 [flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.2 [flutter] - path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface] - path_provider_windows 2.0.3 [ffi flutter meta path path_provider_platform_interface win32] - pedantic 1.11.1 - petitparser 4.3.0 [meta] - platform 3.0.0 - plugin_platform_interface 2.0.2 [meta] - pool 1.5.0 [async stack_trace] - process 4.2.3 [file path platform] - provider 6.0.1 [collection flutter nested] - pub_cache 0.3.1 [path pub_semver yaml] - pub_semver 2.1.0 [collection meta] - pubspec_parse 1.1.0 [checked_yaml collection json_annotation pub_semver yaml] - quiver 3.0.1+1 [matcher] - rational 1.2.1 - resource_portable 3.0.0 [typed_data] - share_plus_linux 2.0.4 [share_plus_platform_interface file flutter meta url_launcher] - share_plus_macos 2.0.2 [share_plus_platform_interface flutter] - share_plus_platform_interface 2.0.1 [flutter meta mime plugin_platform_interface] - share_plus_web 2.0.4 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta] - share_plus_windows 2.0.3 [share_plus_platform_interface flutter meta url_launcher] - shared_preferences 2.0.8 [flutter meta shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shared_preferences_linux 2.0.2 [file meta flutter path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 2.0.2 [flutter shared_preferences_platform_interface] - shared_preferences_platform_interface 2.0.0 [flutter] - shared_preferences_web 2.0.2 [flutter flutter_web_plugins meta shared_preferences_platform_interface] - shared_preferences_windows 2.0.2 [flutter file meta path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.2.0 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 3.0.0 [path shelf shelf_static] - shelf_static 1.1.0 [convert http_parser mime path shelf] - shelf_web_socket 1.0.1 [shelf stream_channel web_socket_channel] - simple_gesture_detector 0.2.0 [flutter] - sky_engine 0.0.99 - source_gen 1.1.1 [analyzer async build dart_style glob meta path source_span yaml] - source_map_stack_trace 2.1.0 [path stack_trace source_maps] - source_maps 0.10.10 [source_span] - source_span 1.8.1 [collection path term_glyph] - sqflite 2.0.0+4 [flutter sqflite_common path] - sqflite_common 2.0.1+1 [synchronized path meta] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - stream_transform 2.0.0 - string_scanner 1.1.0 [charcode source_span] - sync_http 0.3.0 - synchronized 3.0.0 - term_glyph 1.2.0 - test_api 0.4.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.4.0 [analyzer async args boolean_selector collection coverage frontend_server_client glob io meta package_config path pedantic pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api] - timing 1.0.0 [json_annotation] - tool_base 2.0.0 [archive file intl platform process pub_cache collection] - tool_mobile 1.9.5+1 [tool_base] - typed_data 1.3.0 [collection] - url_launcher_linux 2.0.2 [flutter] - url_launcher_macos 2.0.2 [flutter] - url_launcher_platform_interface 2.0.4 [flutter plugin_platform_interface] - url_launcher_web 2.0.4 [flutter flutter_web_plugins meta url_launcher_platform_interface] - url_launcher_windows 2.0.2 [flutter] - vector_math 2.1.0 - vm_service 7.1.1 - watcher 1.0.1 [async path] - web_socket_channel 2.1.0 [async crypto stream_channel] - webdriver 3.0.0 [archive matcher path stack_trace sync_http] - webkit_inspection_protocol 1.0.0 [logging] - win32 2.2.9 [ffi] - xdg_directories 0.2.0 [meta path process] - xml 5.3.0 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```

jangruenwaldt commented 2 years ago

I have followed all the documentation as provided, let me know how I can provide more info. This issue seems to occur for a long time already. I'm a bit confused why no one else experienced it.

darshankawar commented 2 years ago

@jangruenwaldt MissingPluginException is thrown indicating there is some method on the Dart side of the channel that is not implemented on the native side.

In your case, it's throwing No implementation found for method listen on channel plugins.flutter.io/firebase_auth/id-token/[DEFAULT]. The method listen seems to be present already.

Can you try the official firebase_auth plugin example and see if you still get a similar issue with it too ?

Also, please provide entire / complete log of the exception.

jangruenwaldt commented 2 years ago

@jangruenwaldt MissingPluginException is thrown indicating there is some method on the Dart side of the channel that is not implemented on the native side.

In your case, it's throwing No implementation found for method listen on channel plugins.flutter.io/firebase_auth/id-token/[DEFAULT]. The method listen seems to be present already.

Can you try the official firebase_auth plugin example and see if you still get a similar issue with it too ?

Also, please provide entire / complete log of the exception.

Hi, thanks for the answer. I already posted the entire log, there are no more lines. It's from crashlytics.

Unfortunately I can not reproduce it easily, but crashlytics logs shows it happening quite often.

Since I only call a valid method in the Flutter side, I don't think this issue should happen. I will let you know if I find any further information.

The only method I call is listed on the original post.

Another thing is, that it only happens for Android, not iOS. So, I will post my build.gradle files below to help diagnosis:

build.gradle:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:perf-plugin:1.4.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
    tasks.withType(JavaCompile) {
        options.compilerArgs << '-Xlint:-options'
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new Exception("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'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 30
    ndkVersion "22.1.7171670"

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

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }

    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            if (keystorePropertiesFile.exists()) {
                signingConfig signingConfigs.release

                // Enables code shrinking, obfuscation, and optimization for only
                // your project's release build type.
                minifyEnabled true

                // Enables resource shrinking, which is performed by the
                // Android Gradle plugin.
                // shrinkResources true

                // Include native debug symbols file in app bundle automatically
                ndk {
                    debugSymbolLevel 'FULL'
                }

                useProguard true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            } else {
                signingConfig signingConfigs.debug
                println "Signing with debug keys"
            }
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'androidx.core:core:1.6.0'
    implementation 'com.google.guava:guava:29.0-android'
    implementation 'io.grpc:grpc-okhttp:1.32.2'
}
jangruenwaldt commented 2 years ago

This might be related: https://github.com/flutter/flutter/issues/37839

Would be great to have proper documentation here for what is required in terms of obfuscation. Thank you!

darshankawar commented 2 years ago

I tried firebase_auth plugin example on Android and played around a bit but couldn't get to replicate the issue. Keeping it open for further insights from the team.

jangruenwaldt commented 2 years ago

I tried firebase_auth plugin example on Android and played around a bit but couldn't get to replicate the issue. Keeping it open for further insights from the team.

Thank you. We'll try excluding com.firebase.* from proguard and report if the issue disappears.

lewiseman commented 2 years ago

I experienced a similar issue here. This is how i managed to fix it , which is probably not right way, but got me going. I changed firebaseAuth.idTokenChanges() to firebaseAuth.authStateChanges() then closed and run the app again and the error was no longer there

jangruenwaldt commented 2 years ago

I experienced a similar issue here. This is how i managed to fix it , which is probably not right way, but got me going. I changed firebaseAuth.idTokenChanges() to firebaseAuth.authStateChanges() then closed and run the app again and the error was no longer there

Hm, that would be weird if that was really the cause.

By the way, for anyone else reading this: the issue stopped appearing for us when we changed our proguard rules to this:

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

As well as excluding com.firebase.* in proguard-rules.pro

Might not be related, since no way to know if this is causality, but since it does not occur anymore, issue could be closed for us.

russellwheatley commented 2 years ago

Hey @jangruenwaldt, thank you for the feedback πŸ™.