Skip to content

[cloud_firestore] PlatformException when writing data to firestore on Android #2101

Description

@Laebrye

I created a new project using the latest version of the cloud_firestore plugin. It uses anonymous sign in (which works) and writes the data to the database. All works as expected on iOS simulator. Ran on Android physical device (Huawei Mate20 pro) but got the following error when attempting to write data to the DB.

E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): Failed to handle method call
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): java.lang.NullPointerException: Provided data must not be null.
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:906)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at com.google.firebase.firestore.DocumentReference.set(com.google.firebase:firebase-firestore@@21.3.0:161)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at com.google.firebase.firestore.DocumentReference.set(com.google.firebase:firebase-firestore@@21.3.0:146)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin.onMethodCall(CloudFirestorePlugin.java:828)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at android.os.MessageQueue.next(MessageQueue.java:386)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at android.os.Looper.loop(Looper.java:175)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at android.app.ActivityThread.main(ActivityThread.java:7625)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 7665): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

My code - error triggered on the addData method:

import 'dart:convert';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/foundation.dart';
import 'dart:async';


class AppData {
  static final Firestore _firestore = Firestore.instance;

  AppData(
      {@required this.collectionPath,
      String sortField,
      bool descendingOrder = false,
      List<DataFilter> dataFilters,
      int queryLimit}) {
    _ref = _firestore.collection(collectionPath);

    if (dataFilters != null && dataFilters.length > 0) {
      for (DataFilter dataFilter in dataFilters) {
        _query = _query == null
            ? _ref.where(dataFilter.filterField,
                isEqualTo: dataFilter.isEqualTo,
                isGreaterThan: dataFilter.isGreaterThan,
                isGreaterThanOrEqualTo: dataFilter.isGreaterThanOrEqualTo,
                isLessThan: dataFilter.isLessThan,
                isLessThanOrEqualTo: dataFilter.isLessThanOrEqualTo,
                isNull: dataFilter.isNull,
                arrayContains: dataFilter.arrayContains)
            : _query.where(dataFilter.filterField,
                isEqualTo: dataFilter.isEqualTo,
                isGreaterThan: dataFilter.isGreaterThan,
                isGreaterThanOrEqualTo: dataFilter.isGreaterThanOrEqualTo,
                isLessThan: dataFilter.isLessThan,
                isLessThanOrEqualTo: dataFilter.isLessThanOrEqualTo,
                isNull: dataFilter.isNull,
                arrayContains: dataFilter.arrayContains);
      }
    }
    if (sortField != null) {
      _query != null
          ? _query
              .orderBy(
                sortField,
                descending: descendingOrder,
              )
              .limit(queryLimit)
          : _ref
              .orderBy(sortField, descending: descendingOrder)
              .limit(queryLimit);
    }
    if (queryLimit != null) {
      _query != null ? _query.limit(queryLimit) : _ref.limit(queryLimit);
    }
    _stream = _query != null ? _query.snapshots() : _ref.snapshots();
  }

  AppData.fromExisting(
      {AppData original,
      String sortField,
      bool descendingOrder,
      List<DataFilter> dataFilters})
      : this(
          collectionPath: original.collectionPath,
          sortField: sortField,
          descendingOrder: descendingOrder,
          dataFilters: dataFilters,
        );

  CollectionReference get ref => _ref;

  Query _query;
  CollectionReference _ref;
  Stream<QuerySnapshot> _stream;
  QuerySnapshot _snapshot;

  final String collectionPath;

  Future<List<Map<String, dynamic>>> getDocumentsData() async {
    _snapshot = _query != null
        ? await _query.getDocuments()
        : await _ref.getDocuments();
    try {
      return _snapshot.documents.map((f) {
        return f.data;
      }).toList();
    } catch (e) {
      print('Error fetching data from firestore. Error is ${e.toString()}');
    }
    return null;
  }

  Future<Map<String, dynamic>> getDocument(String documentReferenceId) async {
    try {
      DocumentSnapshot snapshot =
          await _ref.document(documentReferenceId).get();
      return snapshot.data;
    } catch (e) {
      print('Error in returning a single document $e');
    }
    return null;
  }

  Stream<Map<String, Map<String, dynamic>>> getQueryStream(
      {String sortField,
      bool descendingOrder = false,
      List<DataFilter> dataFilters}) {
    if (dataFilters != null && dataFilters.length > 0) {
      for (DataFilter dataFilter in dataFilters) {
        _query = _query == null
            ? _ref.where(dataFilter.filterField,
                isEqualTo: dataFilter.isEqualTo,
                isGreaterThan: dataFilter.isGreaterThan,
                isGreaterThanOrEqualTo: dataFilter.isGreaterThanOrEqualTo,
                isLessThan: dataFilter.isLessThan,
                isLessThanOrEqualTo: dataFilter.isLessThanOrEqualTo,
                isNull: dataFilter.isNull,
                arrayContains: dataFilter.arrayContains)
            : _query.where(dataFilter.filterField,
                isEqualTo: dataFilter.isEqualTo,
                isGreaterThan: dataFilter.isGreaterThan,
                isGreaterThanOrEqualTo: dataFilter.isGreaterThanOrEqualTo,
                isLessThan: dataFilter.isLessThan,
                isLessThanOrEqualTo: dataFilter.isLessThanOrEqualTo,
                isNull: dataFilter.isNull,
                arrayContains: dataFilter.arrayContains);
      }
    }
    if (sortField != null) {
      _query != null
          ? _query.orderBy(
              sortField,
              descending: descendingOrder,
            )
          : _ref.orderBy(sortField, descending: descendingOrder);
    }
    _stream = _query != null ? _query.snapshots() : _ref.snapshots();

    return _stream.map((event) {
      Map<String, Map<String, dynamic>> outputMap =
          new Map<String, Map<String, dynamic>>();
      event.documents
          .forEach((f) => outputMap.putIfAbsent(f.documentID, () => f.data));
      return (outputMap);
    });
  }

  Stream<Map<String, Map<String, dynamic>>> getStream() {
    return _stream.transform(
      StreamTransformer<QuerySnapshot,
          Map<String, Map<String, dynamic>>>.fromHandlers(
        handleDone: (sink) => sink.close(),
        handleData: (event, sink) {
          Map<String, Map<String, dynamic>> outputMap =
              new Map<String, Map<String, dynamic>>();
          event.documents.forEach((f) => outputMap.putIfAbsent(
              f.documentID, () => jsonDecode(jsonEncode(f.data))));
          sink.add(outputMap);
        },
      ),
    );
  }

  Stream<Map<String, dynamic>> getSingleDocumentStream(String documentId) {
    return _ref.document(documentId).snapshots().transform(
          StreamTransformer<DocumentSnapshot,
              Map<String, dynamic>>.fromHandlers(
            handleDone: (sink) => sink.close(),
            handleData: (event, sink) => event.data,
            handleError: (error, stackTrace, sink) {
              print(
                  'error handling single document data stream from firestore: $error');
              sink.add({});
            },
          ),
        );
  }

  Future<void> setData(
      {String documentReferenceId, Map<String, dynamic> data}) {
    return _ref.document(documentReferenceId).setData(data).whenComplete(() {
      print('Document $documentReferenceId modified in ${_ref.id}');
    }).catchError((e) {
      print(e);
    });
  }

  Future<dynamic> deleteData(String documentReferenceId) {
    return _ref.document(documentReferenceId).delete().catchError((e) {
      print(e);
      return false;
    });
  }

  Future<String> addData({Map<String, dynamic> data}) async {
    DocumentReference docRef = await _ref.add(data);
    return docRef.documentID;
  }
}

class DataFilter {
  DataFilter({
    this.filterField,
    this.isEqualTo,
    this.isLessThan,
    this.isLessThanOrEqualTo,
    this.isGreaterThan,
    this.isGreaterThanOrEqualTo,
    this.arrayContains,
    this.isNull,
  });

  final String filterField;
  final dynamic isEqualTo;
  final dynamic isLessThan;
  final dynamic isLessThanOrEqualTo;
  final dynamic isGreaterThan;
  final dynamic isGreaterThanOrEqualTo;
  final dynamic arrayContains;
  final bool isNull;
}

Expected behavior
This code should write to the firestore DB without issue - rolling back to 0.12.9 fixes this bug.

Additional context
There is obviously more to this app than my firestore_service file - if needs be I can provide more code, but the error generating issue is definitely triggered in the addData method. I've run this in debug with breakpoints and can verify that there is data being passed to the _ref.add method.

Activity

  1. iapicca commented on Mar 9, 2020

    @iapicca

    Hi @Laebrye
    can you please provide your flutter doctor -v ,
    your flutter run --verbose
    and your pubspec.yaml
    Thank you

  2. Laebrye commented on Mar 9, 2020

    @Laebrye
    Author

    Hi @iapicca,

    Flutter doctor -v:

    [✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.6 18G3020, locale en-GB)
        • Flutter version 1.12.13+hotfix.8 at /Users/Dave/Developer/flutter
        • Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800
        • Engine revision e1e6ced81d
        • Dart version 2.7.0
    
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at /Users/Dave/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 28.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.3.1, Build version 11C504
        • CocoaPods version 1.8.4
    
    [✓] Android Studio (version 3.6)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 44.0.2
        • Dart plugin version 192.7761
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    
    [✓] VS Code (version 1.41.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.7.1
    
    [✓] Connected device (2 available)
        • LYA L09           • F3R7N18B03000744                     • android-arm64 • Android 10 (API 29)
        • iPhone 11 Pro Max • C382D4D3-C9CA-4C36-ABFD-E9C58D799336 • ios           •
          com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
    
    • No issues found!
    
    

    flutter run --verbobse:

    [  +83 ms] calculateSha: LocalDirectory:
    '/Users/Dave/AndroidStudioProjects/easy_a_task/build/app/outputs/apk'/app.apk
    [ +106 ms] calculateSha: reading file took 104us
    [+1396 ms] calculateSha: computing sha took 1396us
    [  +13 ms] ✓ Built build/app/outputs/apk/debug/app-debug.apk.
    [   +8 ms] executing: /Users/Dave/Library/Android/sdk/build-tools/28.0.3/aapt dump
    xmltree /Users/Dave/AndroidStudioProjects/easy_a_task/build/app/outputs/apk/app.apk
    AndroidManifest.xml
    [  +27 ms] Exit code 0 from: /Users/Dave/Library/Android/sdk/build-tools/28.0.3/aapt
    dump xmltree
    /Users/Dave/AndroidStudioProjects/easy_a_task/build/app/outputs/apk/app.apk
    AndroidManifest.xml
    [   +1 ms] N: android=http://schemas.android.com/apk/res/android
                 E: manifest (line=2)
                   A: android:versionCode(0x0101021b)=(type 0x10)0x1
                   A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
                   A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
                   A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
                   A: package="dev.fireballapps.easy_a_task" (Raw:
                   "dev.fireballapps.easy_a_task")
                   A: platformBuildVersionCode=(type 0x10)0x1c
                   A: platformBuildVersionName=(type 0x10)0x9
                   E: uses-sdk (line=7)
                     A: android:minSdkVersion(0x0101020c)=(type 0x10)0x15
                     A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
                   E: uses-permission (line=14)
                     A: android:name(0x01010003)="android.permission.INTERNET" (Raw:
                     "android.permission.INTERNET")
                   E: uses-permission (line=15)
                     A:
                     android:name(0x01010003)="android.permission.ACCESS_NETWORK_STATE"
                     (Raw: "android.permission.ACCESS_NETWORK_STATE")
                   E: uses-permission (line=16)
                     A: android:name(0x01010003)="android.permission.WAKE_LOCK" (Raw:
                     "android.permission.WAKE_LOCK")
                   E: uses-permission (line=17)
                     A:
                     android:name(0x01010003)="com.google.android.finsky.permission.BIND
                     _GET_INSTALL_REFERRER_SERVICE" (Raw:
                     "com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SER
                     VICE")
                   E: uses-permission (line=18)
                     A:
                     android:name(0x01010003)="com.google.android.c2dm.permission.RECEIV
                     E" (Raw: "com.google.android.c2dm.permission.RECEIVE")
                   E: application (line=26)
                     A: android:label(0x01010001)="easy_a_task" (Raw: "easy_a_task")
                     A: android:icon(0x01010002)=@0x7f080000
                     A: android:name(0x01010003)="io.flutter.app.FlutterApplication"
                     (Raw: "io.flutter.app.FlutterApplication")
                     A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                     A:
                     android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComp
                     onentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                     E: activity (line=32)
                       A: android:theme(0x01010000)=@0x7f0a0000
                       A:
                       android:name(0x01010003)="dev.fireballapps.easy_a_task.MainActivi
                       ty" (Raw: "dev.fireballapps.easy_a_task.MainActivity")
                       A: android:launchMode(0x0101001d)=(type 0x10)0x1
                       A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                       A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                       A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                       E: intent-filter (line=39)
                         E: action (line=40)
                           A: android:name(0x01010003)="android.intent.action.MAIN"
                           (Raw: "android.intent.action.MAIN")
                         E: category (line=42)
                           A:
                           android:name(0x01010003)="android.intent.category.LAUNCHER"
                           (Raw: "android.intent.category.LAUNCHER")
                     E: meta-data (line=49)
                       A: android:name(0x01010003)="flutterEmbedding" (Raw:
                       "flutterEmbedding")
                       A: android:value(0x01010024)=(type 0x10)0x2
                     E: service (line=53)
                       A:
                       android:name(0x01010003)="com.google.firebase.components.Componen
                       tDiscoveryService" (Raw:
                       "com.google.firebase.components.ComponentDiscoveryService")
                       A: android:exported(0x01010010)=(type 0x12)0x0
                       A: android:directBootAware(0x01010505)=(type 0x12)0xffffffff
                       E: meta-data (line=57)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:io.flu
                         tter.plugins.firebaseauth.FlutterFirebaseAppRegistrar" (Raw:
                         "com.google.firebase.components:io.flutter.plugins.firebaseauth
                         .FlutterFirebaseAppRegistrar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                       E: meta-data (line=60)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:io.flu
                         tter.plugins.firebase.cloudfirestore.FlutterFirebaseAppRegistra
                         r" (Raw:
                         "com.google.firebase.components:io.flutter.plugins.firebase.clo
                         udfirestore.FlutterFirebaseAppRegistrar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                       E: meta-data (line=63)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:io.flu
                         tter.plugins.firebase.core.FlutterFirebaseAppRegistrar" (Raw:
                         "com.google.firebase.components:io.flutter.plugins.firebase.cor
                         e.FlutterFirebaseAppRegistrar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                       E: meta-data (line=66)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:com.go
                         ogle.firebase.auth.FirebaseAuthRegistrar" (Raw:
                         "com.google.firebase.components:com.google.firebase.auth.Fireba
                         seAuthRegistrar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                       E: meta-data (line=69)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:com.go
                         ogle.firebase.analytics.connector.internal.AnalyticsConnectorRe
                         gistrar" (Raw:
                         "com.google.firebase.components:com.google.firebase.analytics.c
                         onnector.internal.AnalyticsConnectorRegistrar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                       E: meta-data (line=72)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:com.go
                         ogle.firebase.firestore.FirestoreRegistrar" (Raw:
                         "com.google.firebase.components:com.google.firebase.firestore.F
                         irestoreRegistrar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                       E: meta-data (line=75)
                         A:
                         android:name(0x01010003)="com.google.firebase.components:com.go
                         ogle.firebase.iid.Registrar" (Raw:
                         "com.google.firebase.components:com.google.firebase.iid.Registr
                         ar")
                         A:
                         android:value(0x01010024)="com.google.firebase.components.Compo
                         nentRegistrar" (Raw:
                         "com.google.firebase.components.ComponentRegistrar")
                     E: activity (line=80)
                       A: android:theme(0x01010000)=@0x1030010
                       A:
                       android:name(0x01010003)="com.google.firebase.auth.internal.Feder
                       atedSignInActivity" (Raw:
                       "com.google.firebase.auth.internal.FederatedSignInActivity")
                       A:
                       android:permission(0x01010006)="com.google.firebase.auth.api.gms.
                       permission.LAUNCH_FEDERATED_SIGN_IN" (Raw:
                       "com.google.firebase.auth.api.gms.permission.LAUNCH_FEDERATED_SIG
                       N_IN")
                       A: android:exported(0x01010010)=(type 0x12)0xffffffff
                       A: android:excludeFromRecents(0x01010017)=(type 0x12)0xffffffff
                       A: android:launchMode(0x0101001d)=(type 0x10)0x2
                     E: receiver (line=88)
                       A:
                       android:name(0x01010003)="com.google.android.gms.measurement.AppM
                       easurementReceiver" (Raw:
                       "com.google.android.gms.measurement.AppMeasurementReceiver")
                       A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                       A: android:exported(0x01010010)=(type 0x12)0x0
                     E: receiver (line=93)
                       A:
                       android:name(0x01010003)="com.google.android.gms.measurement.AppM
                       easurementInstallReferrerReceiver" (Raw:
                       "com.google.android.gms.measurement.AppMeasurementInstallReferrer
                       Receiver")
                       A:
                       android:permission(0x01010006)="android.permission.INSTALL_PACKAG
                       ES" (Raw: "android.permission.INSTALL_PACKAGES")
                       A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                       A: android:exported(0x01010010)=(type 0x12)0xffffffff
                       E: intent-filter (line=98)
                         E: action (line=99)
                           A:
                           android:name(0x01010003)="com.android.vending.INSTALL_REFERRE
                           R" (Raw: "com.android.vending.INSTALL_REFERRER")
                     E: service (line=103)
                       A:
                       android:name(0x01010003)="com.google.android.gms.measurement.AppM
                       easurementService" (Raw:
                       "com.google.android.gms.measurement.AppMeasurementService")
                       A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                       A: android:exported(0x01010010)=(type 0x12)0x0
                     E: service (line=107)
                       A:
                       android:name(0x01010003)="com.google.android.gms.measurement.AppM
                       easurementJobService" (Raw:
                       "com.google.android.gms.measurement.AppMeasurementJobService")
                       A:
                       android:permission(0x01010006)="android.permission.BIND_JOB_SERVI
                       CE" (Raw: "android.permission.BIND_JOB_SERVICE")
                       A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                       A: android:exported(0x01010010)=(type 0x12)0x0
                     E: receiver (line=113)
                       A:
                       android:name(0x01010003)="com.google.firebase.iid.FirebaseInstanc
                       eIdReceiver" (Raw:
                       "com.google.firebase.iid.FirebaseInstanceIdReceiver")
                       A:
                       android:permission(0x01010006)="com.google.android.c2dm.permissio
                       n.SEND" (Raw: "com.google.android.c2dm.permission.SEND")
                       A: android:exported(0x01010010)=(type 0x12)0xffffffff
                       E: intent-filter (line=117)
                         E: action (line=118)
                           A:
                           android:name(0x01010003)="com.google.android.c2dm.intent.RECE
                           IVE" (Raw: "com.google.android.c2dm.intent.RECEIVE")
                     E: provider (line=122)
                       A:
                       android:name(0x01010003)="com.google.firebase.provider.FirebaseIn
                       itProvider" (Raw:
                       "com.google.firebase.provider.FirebaseInitProvider")
                       A: android:exported(0x01010010)=(type 0x12)0x0
                       A:
                       android:authorities(0x01010018)="dev.fireballapps.easy_a_task.fir
                       ebaseinitprovider" (Raw:
                       "dev.fireballapps.easy_a_task.firebaseinitprovider")
                       A: android:initOrder(0x0101001a)=(type 0x10)0x64
                     E: activity (line=128)
                       A: android:theme(0x01010000)=@0x1030010
                       A:
                       android:name(0x01010003)="com.google.android.gms.common.api.Googl
                       eApiActivity" (Raw:
                       "com.google.android.gms.common.api.GoogleApiActivity")
                       A: android:exported(0x01010010)=(type 0x12)0x0
                     E: meta-data (line=133)
                       A: android:name(0x01010003)="com.google.android.gms.version"
                       (Raw: "com.google.android.gms.version")
                       A: android:value(0x01010024)=@0x7f060000
    [ +129 ms] Stopping app 'app.apk' on LYA L09.
    [   +9 ms] executing: /Users/Dave/Library/Android/sdk/platform-tools/adb -s
    F3R7N18B03000744 shell am force-stop dev.fireballapps.easy_a_task
    [  +85 ms] executing: /Users/Dave/Library/Android/sdk/platform-tools/adb -s
    F3R7N18B03000744 shell pm list packages dev.fireballapps.easy_a_task
    [  +65 ms] package:dev.fireballapps.easy_a_task
    [   +6 ms] executing: /Users/Dave/Library/Android/sdk/platform-tools/adb -s
    F3R7N18B03000744 shell cat /data/local/tmp/sky.dev.fireballapps.easy_a_task.sha1
    [  +46 ms] 48eb93c59315110a850d419a1bd3b123ca08f0a6
    [   +1 ms] Latest build already installed.
    [        ] LYA L09 startApp
    [   +4 ms] executing: /Users/Dave/Library/Android/sdk/platform-tools/adb -s
    F3R7N18B03000744 shell am start -a android.intent.action.RUN -f 0x20000000 --ez
    enable-background-compilation true --ez enable-dart-profiling true --ez
    enable-checked-mode true --ez verify-entry-points true
    dev.fireballapps.easy_a_task/dev.fireballapps.easy_a_task.MainActivity
    [  +74 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000
    cmp=dev.fireballapps.easy_a_task/.MainActivity (has extras) }
    [        ] Waiting for observatory port to be available...
    [ +312 ms] D/FlutterActivity(29381): Using the launch theme as normal theme.
    [   +2 ms] D/FlutterActivityAndFragmentDelegate(29381): Setting up FlutterEngine.
    [        ] D/FlutterActivityAndFragmentDelegate(29381): No preferred FlutterEngine
    was provided. Creating a new FlutterEngine for this FlutterFragment.
    [  +74 ms] D/FlutterActivityAndFragmentDelegate(29381): Attaching FlutterEngine to
    the Activity that owns this Fragment.
    [  +33 ms] D/FlutterView(29381): Attaching to a FlutterEngine:
    io.flutter.embedding.engine.FlutterEngine@a4e66ef
    [   +6 ms] D/FlutterActivityAndFragmentDelegate(29381): Executing Dart entrypoint:
    main, and sending initial route: /
    [ +196 ms] Observatory URL on device: http://127.0.0.1:33465/HWYcxZFhrUI=/
    [   +2 ms] executing: /Users/Dave/Library/Android/sdk/platform-tools/adb -s
    F3R7N18B03000744 forward tcp:0 tcp:33465
    [  +11 ms] 61900
    [        ] Forwarded host port 61900 to device port 33465 for Observatory
    [  +19 ms] Connecting to service protocol: http://127.0.0.1:61900/HWYcxZFhrUI=/
    [ +147 ms] I/flutter (29381): AuthWidgetBuilder rebuild
    [  +14 ms] I/flutter (29381): User StreamBuilder: ConnectionState.waiting
    [  +29 ms] Successfully connected to service protocol:
    http://127.0.0.1:61900/HWYcxZFhrUI=/
    [   +8 ms] Sending to VM service: getVM({})
    [   +5 ms] Result: {type: VM, name: vm, architectureBits: 64, hostCPU: Hisilicon
    Kirin980, operatingSystem: android, targetCPU: arm64, version: 2.7.0 (Fri Dec 6
    16:26:51 2019 +0100) on "android_arm64", _profilerMode: VM, _nativeZoneMemoryUsage:
    0, pid: 29381, startT...
    [   +7 ms] Sending to VM service: getIsolate({isolateId: isolates/1157573201975875})
    [   +8 ms] Sending to VM service: _flutter.listViews({})
    [  +25 ms] Result: {type: Isolate, id: isolates/1157573201975875, name: main,
    number: 1157573201975875, _originNumber: 1157573201975875, startTime: 1583768144324,
    _heaps: {new: {type: HeapSpace, name: new, vmName: Scavenger, collections: 0,
    avgCollectionPeriodMillis...
    [  +18 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id:
    _flutterView/0x7b77028620, isolate: {type: @Isolate, fixedId: true, id:
    isolates/1157573201975875, name: main.dart$main-1157573201975875, number:
    1157573201975875}}]}
    [   +6 ms] DevFS: Creating new filesystem on the device (null)
    [   +1 ms] Sending to VM service: _createDevFS({fsName: easy_a_task})
    [  +22 ms] Result: {type: FileSystem, name: easy_a_task, uri:
    file:///data/user/0/dev.fireballapps.easy_a_task/code_cache/easy_a_taskVQQSAS/easy_a
    _task/}
    [        ] DevFS: Created new filesystem on the device
    (file:///data/user/0/dev.fireballapps.easy_a_task/code_cache/easy_a_taskVQQSAS/easy_
    a_task/)
    [   +3 ms] Updating assets
    [ +122 ms] Syncing files to device LYA L09...
    [   +2 ms] Scanning asset files
    [   +5 ms] <- reset
    [        ] Compiling dart to kernel with 0 updated files
    [  +11 ms] /Users/Dave/Developer/flutter/bin/cache/dart-sdk/bin/dart
    /Users/Dave/Developer/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.
    dart.snapshot --sdk-root
    /Users/Dave/Developer/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/
    --incremental --target=flutter -Ddart.developer.causal_async_stacks=true
    --output-dill
    /var/folders/zy/9_phhd_940x9rp9w831x1l500000gn/T/flutter_tool.leCdtF/app.dill
    --packages /Users/Dave/AndroidStudioProjects/easy_a_task/.packages
    -Ddart.vm.profile=false -Ddart.vm.product=false
    --bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-ini
    tializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts
    --track-widget-creation --filesystem-scheme org-dartlang-root
    [   +9 ms] <- compile package:easy_a_task/main.dart
    [  +80 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    [  +20 ms] I/flutter (29381): user: ZJvHksu00ccpItPFDZjDea7t4Xw2
    [   +6 ms] I/flutter (29381): User StreamBuilder: ConnectionState.active
    [  +27 ms] I/flutter (29381): weight entry stream should be updated
    [  +19 ms] I/flutter (29381): HomeBlocModel connection state =
    ConnectionState.waiting
    [  +30 ms] W/DynamiteModule(29381): Local module descriptor class for
    providerinstaller not found.
    [   +7 ms] D/ConnectivityManager(29381): requestNetwork and the calling app is:
    dev.fireballapps.easy_a_task
    [        ] I/DynamiteModule(29381): Considering local module providerinstaller:0 and
    remote module providerinstaller:0
    [   +1 ms] W/ProviderInstaller(29381): Failed to load providerinstaller module: No
    acceptable module found. Local version is 0 and remote version is 0.
    [   +2 ms] I/pps.easy_a_tas(29381): The ClassLoaderContext is a special shared
    library.
    [        ] I/chatty  (29381): uid=10373(dev.fireballapps.easy_a_task) AsyncTask #1
    identical 1 line
    [        ] I/pps.easy_a_tas(29381): The ClassLoaderContext is a special shared
    library.
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api,
    linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api,
    linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->copyMemory(JJJ)V (greylist, linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J
    (greylist,core-platform-api, linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->getByte(J)B (greylist,core-platform-api, linking, allowed)
    [   +1 ms] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->getByte(Ljava/lang/Object;J)B (greylist,core-platform-api,
    linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->getLong(J)J (greylist,core-platform-api, linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->putByte(JB)V (greylist,core-platform-api, linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->putByte(Ljava/lang/Object;JB)V (greylist,core-platform-api,
    linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api,
    reflection, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api,
    reflection, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden field
    Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
    [   +3 ms] V/NativeCrypto(29381): Registering
    com/google/android/gms/org/conscrypt/NativeCrypto's 286 native methods...
    [   +5 ms] W/pps.easy_a_tas(29381): Accessing hidden method
    Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (greylist,
    reflection, allowed)
    [  +13 ms] D/NetworkSecurityConfig(29381): No Network Security Config specified,
    using platform default
    [        ] I/ProviderInstaller(29381): Installed default security provider
    GmsCore_OpenSSL
    [  +25 ms] D/ConnectivityManager(29381): requestNetwork and the calling app is:
    dev.fireballapps.easy_a_task
    [  +20 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    [  +26 ms] I/flutter (29381): new WeightEntry added to list - length: 9
    [   +1 ms] I/flutter (29381): HomeBlocModel connection state =
    ConnectionState.active
    [  +89 ms] W/pps.easy_a_tas(29381): Accessing hidden field
    Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (greylist, reflection, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard;
    (greylist,core-platform-api, linking, allowed)
    [   +1 ms] W/pps.easy_a_tas(29381): Accessing hidden method
    Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api,
    linking, allowed)
    [   +1 ms] W/pps.easy_a_tas(29381): Accessing hidden field
    Ljava/io/FileDescriptor;->descriptor:I (greylist, JNI, allowed)
    [  +77 ms] W/pps.easy_a_tas(29381): Accessing hidden method
    Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (greylist,
    reflection, allowed)
    [  +16 ms] W/pps.easy_a_tas(29381): Accessing hidden method
    Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy;
    (greylist,core-platform-api, linking, allowed)
    [        ] W/pps.easy_a_tas(29381): Accessing hidden method
    Ldalvik/system/BlockGuard$Policy;->onNetwork()V (greylist, linking, allowed)
    [  +63 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    [+3587 ms] I/AwareBitmapCacher(29381): init lrucache size: 2097152 pid=29381
    [+3887 ms] Updating files
    [ +152 ms] DevFS: Sync finished
    [   +2 ms] Syncing files to device LYA L09... (completed in 8,210ms, longer than
    expected)
    [   +1 ms] Synced 0.9MB.
    [   +2 ms] Sending to VM service: _flutter.listViews({})
    [   +4 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id:
    _flutterView/0x7b77028620, isolate: {type: @Isolate, fixedId: true, id:
    isolates/1157573201975875, name: main.dart$main-1157573201975875, number:
    1157573201975875}}]}
    [   +1 ms] <- accept
    [        ] Connected to _flutterView/0x7b77028620.
    [   +8 ms] 🔥  To hot reload changes while running, press "r". To hot restart (and
    rebuild
               state), press "R".
    [   +3 ms] An Observatory debugger and profiler on LYA L09 is available at:
               http://127.0.0.1:61900/HWYcxZFhrUI=/
    [        ] For a more detailed help message, press "h". To detach, press "d"; to
    quit, press
               "q".
    [+55974 ms] W/Settings(29381): Setting device_provisioned has moved from
    android.provider.Settings.Secure to android.provider.Settings.Global.
    [        ] V/HiTouch_HiTouchSensor(29381): User setup is finished.
    [  +95 ms] V/AudioManager(29381): querySoundEffectsEnabled...
    [  +49 ms] I/flutter (29381): HomeBlocModel connection state =
    ConnectionState.active
    [  +58 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    [ +239 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    [   +6 ms] I/flutter (29381): HomeBlocModel connection state =
    ConnectionState.active
    [  +51 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    [ +974 ms] V/AudioManager(29381): querySoundEffectsEnabled...
    [   +6 ms] I/flutter (29381): adding data - user is ZJvHksu00ccpItPFDZjDea7t4Xw2
    [   +2 ms] I/flutter (29381): AppData ref:
    users/ZJvHksu00ccpItPFDZjDea7t4Xw2/weight_entries
    [   +9 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381): Failed to
    handle method call
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):
    java.lang.NullPointerException: Provided data must not be null.
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    com.google.common.base.Preconditions.checkNotNull(Preconditions.java:906)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    com.google.firebase.firestore.DocumentReference.set(com.google.firebase:firebase-fir
    estore@@21.3.0:161)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    com.google.firebase.firestore.DocumentReference.set(com.google.firebase:firebase-fir
    estore@@21.3.0:146)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin.onMethodCall(CloudFi
    restorePlugin.java:828)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodCha
    nnel.java:231)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.j
    ava:93)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
    [   +1 ms] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    android.os.MessageQueue.nativePollOnce(Native Method)
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    android.os.MessageQueue.next(MessageQueue.java:363)
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    android.os.Looper.loop(Looper.java:173)
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    android.app.ActivityThread.main(ActivityThread.java:8147)
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    java.lang.reflect.Method.invoke(Native Method)
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    [        ] E/MethodChannel#plugins.flutter.io/cloud_firestore(29381):   at
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
    [  +27 ms] I/flutter (29381): error adding WeightEntry to Firestore:
    PlatformException(error, Provided data must not be null., null)
    [  +30 ms] I/flutter (29381): HomeBlocModel connection state =
    ConnectionState.active
    [  +72 ms] E/AccessibilityBridge(29381): VirtualView node must not be the root node.
    
    

    pubspec.yaml:

    name: easy_a_task
    description: Easy A take-home project
    
    # The following defines the version and build number for your application.
    # A version number is three numbers separated by dots, like 1.2.43
    # followed by an optional build number separated by a +.
    # Both the version and the builder number may be overridden in flutter
    # build by specifying --build-name and --build-number, respectively.
    # In Android, build-name is used as versionName while build-number used as versionCode.
    # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
    # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
    # Read more about iOS versioning at
    # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
    version: 1.0.0+1
    
    environment:
      sdk: ">=2.1.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
    
      #older firebase_auth version used to solve iOS build issue with "'UserAgent.h' file not found" error
      firebase_auth: 0.15.3
      cloud_firestore: 0.13.4
    
      rxdart: ^0.23.1
    
      provider: ^4.0.4
    
      intl: ^0.16.1
    
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.2
    
    # Dependency override put in place to solve iOS build issue with "'UserAgent.h' file not found" error
    dependency_overrides:
      firebase_core: 0.4.4
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
    
    # For information on the generic Dart part of this file, see the
    # following page: https://dart.dev/tools/pub/pubspec
    
    # The following section is specific to Flutter.
    flutter:
    
      # The following line ensures that the Material Icons font is
      # included with your application, so that you can use the icons in
      # the material Icons class.
      uses-material-design: true
    
      # To add assets to your application, add an assets section, like this:
      # assets:
      #  - images/a_dot_burr.jpeg
      #  - images/a_dot_ham.jpeg
    
      # An image asset can refer to one or more resolution-specific "variants", see
      # https://flutter.dev/assets-and-images/#resolution-aware.
    
      # For details regarding adding assets from package dependencies, see
      # https://flutter.dev/assets-and-images/#from-packages
    
      # To add custom fonts to your application, add a fonts section here,
      # in this "flutter" section. Each entry in this list should have a
      # "family" key with the font family name, and a "fonts" key with a
      # list giving the asset and other descriptors for the font. For
      # example:
      # fonts:
      #   - family: Schyler
      #     fonts:
      #       - asset: fonts/Schyler-Regular.ttf
      #       - asset: fonts/Schyler-Italic.ttf
      #         style: italic
      #   - family: Trajan Pro
      #     fonts:
      #       - asset: fonts/TrajanPro.ttf
      #       - asset: fonts/TrajanPro_Bold.ttf
      #         weight: 700
      #
      # For details regarding fonts from package dependencies,
      # see https://flutter.dev/custom-fonts/#from-packages
    
    

    Please note that I attempted to run this with firestore version set as ^0.13.4 and the write action completed successfully, so it would seem that this issue has been fixed in version 0.13.4+1. Happy for this issue to be closed if you agree.

    Kind regards
    Dave

  3. added
    impact: customerA bug with low impact (e.g. affecting only a few customers or has a workaround). (P3)
    platform: iosIssues / PRs which are specifically for iOS.
    on Apr 20, 2020
  4. Salakar commented on Jul 7, 2020

    @Salakar
    Contributor

    Hey, as part of our on-going work for #2582, this has been resolved in our Firebase Firestore rework (#2913) - which has now been merged into master. We'll look at publishing some prereleases in the next few days. Thank you

  5. locked and limited conversation to collaborators on Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact: customerA bug with low impact (e.g. affecting only a few customers or has a workaround). (P3)platform: iosIssues / PRs which are specifically for iOS.plugin: cloud_firestoretype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions