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

🐛 [firebase_crashlytics] Execution failed for task ':app:uploadCrashlyticsMappingFileProductionRelease'. Host name may not be empty #7029

Closed petermusembi69 closed 2 years ago

petermusembi69 commented 2 years ago

Bug report

Describe the bug I configured and implemented crashlytics as explained in the docs. While running the app in debug mode on my emulator, I was able to simulate a crash and have it reflect on my firebase console dashboard (image). The problem arises when creating a signed release APK as this fails with the error below.

Error logs
$ flutter build apk --flavor production --target lib/main_production.dart

Building with sound null safety
Running Gradle task 'assembleProductionRelease'...
Parameter format not correct -
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:uploadCrashlyticsMappingFileProductionRelease'.
> Host name may not be empty

BUILD FAILED in 1m 43s
Running Gradle task 'assembleProductionRelease'...                105.2s
Gradle task assembleProductionRelease failed with exit code 1

Removing the crashlytics Gradle configuration builds the release APK successfully. I am very certain the issue is related to the Gradle configuration. Here is my app-level build Gradle gist and my project-level build Gradle gist and finaly my gradle.properties gist.

Steps to reproduce

Steps to reproduce the behavior:

  1. Add crashlytics plugin in pubspec.ymal
  2. Confirgure gradle files as per the docs.
  3. Add the crashlytics in main() function in my dart file as shown below.

    void main() async {
    await runZonedGuarded<Future<void>>(
    () async {
      WidgetsFlutterBinding.ensureInitialized();
      await Firebase.initializeApp();
    
      if (kDebugMode) {
        await FirebaseCrashlytics.instance
            .setCrashlyticsCollectionEnabled(true);
      } else {
        FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
      }
    
      Isolate.current.addErrorListener(RawReceivePort((pair) async {
        final List<dynamic> errorAndStacktrace = pair;
        await FirebaseCrashlytics.instance.recordError(
          errorAndStacktrace.first,
          errorAndStacktrace.last,
        );
      }).sendPort);
    
      runZonedGuarded(
        () => runApp(const Tradepoint()),
        (error, stackTrace) => log(error.toString(), stackTrace: stackTrace),
      );
    },
    
    (error, stackTrace) =>
        FirebaseCrashlytics.instance.recordError(error, stackTrace),
    );
    }
  4. Build a release APK.

Expected behavior

Build a signed release APK successfully after configuration.

Sample project

N/A


Additional context

I am using the very good ventures template.


Flutter doctor

``` yaml Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19043.1237], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [√] Chrome - develop for the web [√] Android Studio (version 4.1.0) [√] VS Code (version 1.60.1) [√] Connected device (2 available) • No issues found! ```

Flutter dependencies

```cmd Dart SDK 2.12.3 Flutter SDK 2.0.6 dependencies: - animated_text_kit 4.2.1 [flutter characters] - animations 2.0.0 [flutter] - bloc 7.0.0 [meta] - connectivity 3.0.4 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web] - cupertino_icons 1.0.2 - firebase_auth 1.1.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 1.6.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.2.1 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - fl_chart 0.20.1 [flutter path_drawing equatable pedantic] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_bloc 7.0.1 [flutter bloc provider] - flutter_cupertino_datetime_picker 2.0.1 [flutter] - flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math] - flutter_rating_bar 4.0.0 [flutter] - flutter_screenutil 5.0.0 [flutter] - flutter_slidable 0.6.0 [flutter] - flutter_svg 0.21.0+1 [flutter meta path_drawing vector_math xml] - freezed_annotation 0.14.1 [collection json_annotation meta] - geocoding 2.0.0 [flutter geocoding_platform_interface] - get_it 7.1.3 [async collection] - google_fonts 2.1.0 [flutter http path_provider crypto] - google_maps_flutter 2.0.6 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface] - hive 2.0.4 [meta crypto] - hive_flutter 1.0.0 [flutter hive path_provider path] - http 0.13.1 [http_parser meta path pedantic] - intl 0.17.0 [clock path] - libphonenumber 2.0.0 [flutter meta] - location 4.3.0 [flutter location_platform_interface location_web] - logger 1.0.0 - octo_image 1.0.0+1 [flutter flutter_blurhash] - pin_code_text_field 1.8.0 [flutter] - pixel_perfect 1.1.0 [flutter] - readmore 2.1.0 [flutter] - top_snackbar_flutter 1.0.0 [flutter] - uuid 3.0.4 [crypto] - wechat_assets_picker 5.5.0 [flutter extended_image photo_manager provider video_player] - wechat_camera_picker 2.2.0 [flutter camera device_info path path_provider photo_manager video_player] dev dependencies: - bloc_test 8.0.0 [bloc meta mocktail test] - build_runner 1.12.2 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - flutter_launcher_icons 0.9.0 [args image path yaml] - flutter_native_splash 1.1.8+4 [image meta path xml yaml universal_io] - 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] - freezed 0.14.1+2 [analyzer build build_config meta source_gen freezed_annotation] - hive_generator 1.1.0 [build source_gen hive analyzer source_helper] - json_serializable 4.1.1 [analyzer build build_config collection json_annotation meta path source_gen] - mocktail 0.1.1 [collection matcher test] - very_good_analysis 2.0.3 [pedantic] transitive dependencies: - _fe_analyzer_shared 21.0.0 [meta] - analyzer 1.5.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml pedantic] - archive 3.1.2 [crypto path] - args 2.0.0 - async 2.5.0 [collection] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.0.1 [analyzer async convert crypto glob logging meta path] - build_config 0.4.7 [checked_yaml json_annotation meta path pubspec_parse yaml] - build_daemon 2.1.10 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.0.0 [analyzer build crypto graphs logging path package_config pool pub_semver stream_transform] - build_runner_core 6.1.12 [async build build_config build_resolvers collection convert crypto glob graphs logging meta path package_config pedantic pool timing watcher yaml] - built_collection 5.0.0 - built_value 8.0.4 [built_collection collection fixnum] - camera 0.8.1+3 [camera_platform_interface flutter pedantic quiver] - camera_platform_interface 2.0.1 [flutter meta plugin_platform_interface cross_file stream_transform] - characters 1.1.0 - charcode 1.2.0 - checked_yaml 2.0.1 [json_annotation source_span yaml] - cli_util 0.3.0 [meta path] - clock 1.1.0 - code_builder 3.7.0 [built_collection built_value collection matcher meta] - collection 1.15.0 - connectivity_for_web 0.4.0 [connectivity_platform_interface flutter_web_plugins flutter] - connectivity_macos 0.2.0 [flutter] - connectivity_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - convert 3.0.0 [typed_data] - coverage 1.0.2 [args logging package_config path source_maps stack_trace vm_service] - cross_file 0.3.1+1 [flutter meta] - crypto 3.0.1 [collection typed_data] - dart_style 2.0.0 [analyzer args path pub_semver source_span] - device_info 2.0.2 [flutter device_info_platform_interface] - device_info_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - equatable 2.0.0 [collection meta] - extended_image 4.1.0 [extended_image_library flutter meta] - extended_image_library 3.1.0 [crypto flutter http_client_helper path path_provider] - fake_async 1.2.0 [clock collection] - ffi 1.0.0 - file 6.1.0 [meta path] - firebase_auth_platform_interface 4.1.1 [firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 1.0.7 [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.2 [collection firebase_core flutter meta plugin_platform_interface] - fixnum 1.0.0 - flutter_blurhash 0.6.0 [flutter meta pedantic] - flutter_plugin_android_lifecycle 2.0.2 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math] - geocoding_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - glob 2.0.1 [async collection file path pedantic string_scanner] - google_maps_flutter_platform_interface 2.1.0 [collection flutter meta plugin_platform_interface stream_transform] - graphs 1.0.0 - http_client_helper 2.0.2 [http] - http_multi_server 3.0.1 [async] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image 3.0.2 [archive meta xml] - io 1.0.0 [meta path string_scanner] - js 0.6.3 - json_annotation 4.0.1 - location_platform_interface 2.3.0 [flutter meta plugin_platform_interface] - location_web 3.1.1 [flutter flutter_web_plugins http_parser js location_platform_interface meta] - logging 1.0.1 - matcher 0.12.10 [stack_trace] - meta 1.3.0 - mime 1.0.0 - nested 1.0.0 [flutter] - node_preamble 1.4.13 - package_config 2.0.0 [path] - path 1.8.0 - path_drawing 0.5.0 [vector_math meta path_parsing flutter] - path_parsing 0.2.0 [vector_math meta] - path_provider 2.0.1 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows] - path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 2.0.0 [flutter] - path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface] - path_provider_windows 2.0.0 [path_provider_platform_interface meta path flutter ffi win32] - pedantic 1.11.0 - petitparser 4.1.0 [meta] - photo_manager 1.1.6 [flutter] - platform 3.0.0 - plugin_platform_interface 2.0.0 [meta] - pool 1.5.0 [async stack_trace] - process 4.2.1 [file path platform] - provider 5.0.0 [collection flutter nested] - pub_semver 2.0.0 [collection] - pubspec_parse 1.0.0 [checked_yaml collection json_annotation pub_semver yaml] - quiver 3.0.1 [matcher] - shelf 1.1.0 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 3.0.0 [path shelf shelf_static] - shelf_static 1.0.0 [convert http_parser mime path shelf] - shelf_web_socket 1.0.1 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.0.0 [analyzer async build dart_style glob meta path pedantic source_span] - source_helper 1.1.0 [analyzer collection source_gen] - source_map_stack_trace 2.1.0 [path stack_trace source_maps] - source_maps 0.10.10 [source_span] - source_span 1.8.0 [charcode collection path term_glyph] - 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] - term_glyph 1.2.0 - test 1.16.5 [analyzer async boolean_selector 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] - test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.3.15 [analyzer async args boolean_selector collection coverage 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] - typed_data 1.3.0 [collection] - universal_io 2.0.4 [collection crypto meta typed_data] - vector_math 2.1.0 - video_player 2.1.1 [meta video_player_platform_interface video_player_web flutter flutter_test] - video_player_platform_interface 4.1.0 [flutter meta flutter_test] - video_player_web 2.0.0 [flutter flutter_web_plugins meta video_player_platform_interface] - vm_service 6.2.0 - watcher 1.0.0 [async path pedantic] - web_socket_channel 2.0.0 [async crypto stream_channel] - webkit_inspection_protocol 1.0.0 [logging] - win32 2.0.5 [ffi] - xdg_directories 0.2.0 [meta path process] - xml 5.1.0 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```

markusaksli-nc commented 2 years ago

Hi @petermusembi69 I noticed a couple of issues in your setup.

  1. You seem to be using a really outdated version of firebase_auth based on your pub deps. The latest is 3.1.1.
  2. Is there any reason you are overriding the native SDK versions in app/build.gradle? The FlutterFire plugins manage these versions internally and are tested against a fixed version. If you override the native SDK then we can't guarantee any behavior.
  3. You are using an outdated version of com.google.gms:google-services:4.3.5. The version we recommend is 4.3.8

These are unlikely to be causing the problem but it's better to check this from a clean setup. Thank you

petermusembi69 commented 2 years ago

Hey @markusaksli-nc ,

Thank you for your response, I did change firebase_auth version to 3.1.1. Concerning overriding the native SDK, that is done when you create a flutter project with VGV, and maybe over time, I made a few edits, however, I removed some dependencies and had this

dependencies {
    implementation 'com.android.support:multidex:1.0.3'
    implementation platform('com.google.firebase:firebase-bom:26.8.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation "androidx.browser:browser:1.2.0"
}

I hope this is in order. I also upgraded the version to com.google.gms:google-services:4.3.8. But the same error is persistent.

However I was able to build an apk on this GitHub workflow, which is kind of weird, so that means the issue could be with my current Gradle version or some setup of sorts. I think we can close this issue then If I fix the issue in my local set up I will make sure to comment below.

markusaksli-nc commented 2 years ago

The only problem really is that the BOM version you are overriding is behind the current internally managed version for the plugins https://github.com/FirebaseExtended/flutterfire/blob/cc13c55d3bdd70c53a864d0cbaa0240d81f1d7c0/packages/firebase_core/firebase_core/android/gradle.properties#L2

Try to see if that fixes it? I'll close the issue for now but let me know if you get stuck.