Skip to content

Build failed when adding segment_analytics_plugin_firebase on iOS/Android #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
officialkhairi opened this issue Oct 28, 2024 · 1 comment

Comments

@officialkhairi
Copy link
Contributor

officialkhairi commented Oct 28, 2024

I've added the plugin but build failes

on iOS :

segment_analytics_plugin_firebase

`
Error showing:
Failed to build iOS app Error (Xcode): ../../.pub-cache/git/analytics_flutter-6dd36b60c867e7af2433cce3f5db13ae0a08f47e/packages/plugins/plugin_firebase/lib/plugin_firebase.dart:205:27: Error: The argument type 'Map<String, Object?>' can't be assigned to the parameter type 'Map<String, Object>?' because 'Object?' is nullable and 'Object' isn't. Could not build the application for the simulator. Error launching application on iPhone 16.

`

on Android :

`../../.pub-cache/git/analytics_flutter-6dd36b60c867e7af2433cce3f5db13ae0a08f47e/packages/plugins/plugin_firebase/lib/plugin_firebase.dart:205:27: Error: The argument type 'Map<String, Object?>' can't be assigned to the parameter type 'Map<String, Object>?' because 'Object?' is nullable and 'Object' isn't.

  • 'Map' is from 'dart:core'.
  • 'Object' is from 'dart:core'.
    parameters: castParameterType(properties));
    ^
    Target kernel_snapshot_program failed: Exception

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/xkk/Documents/Dev/flutter/bin/flutter'' finished with non-zero exit value 1

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

BUILD FAILED in 33s
Error: Gradle task assembleDebug failed with exit code 1`

@neelkanth-kaushik
Copy link
Contributor

Hi @officialkhairi ,

Thanks for reporting this issue. We’ve attempted to reproduce it on our end but haven't been successful so far. That said, the error you shared appears to originate from the this line in the code: plugin_firebase.dart#L205

Specifically, the method castParameterType(properties) relies on Dart’s inferred types and may throw an error if properties is not exactly of type Map<String, Object?>.

To help us troubleshoot further, could you please provide the following details?

  1. The version of segment_analytics you're using
  2. The version of segment_analytics_plugin_firebase you're using
  3. The actual type of the properties variable passed to castParameterType(properties) – is it typed as Map<String, Object?>, or something else?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants