Sarthak Verma
Sarthak Verma

Reputation: 438

Flutter Application Crashing Only In Release Mode

I have a Flutter App that is working totally fine when installed in Debug Mode via Android Studio and Crashing after Login when in Release Mode. I have the Crash Report taken from Play Console:

java.lang.RuntimeException: 
  at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:379)
  at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run (AsyncQueue.java:2)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:198)
  at android.app.ActivityThread.main (ActivityThread.java:6732)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.AbstractMethodError: 
  at com.google.protobuf.GeneratedMessageLite.a (GeneratedMessageLite.java:1319)
  at com.google.firestore.v1.Target$DocumentsTarget.ensureDocumentsIsMutable (Target.java:145)
  at com.google.firestore.v1.Target$DocumentsTarget.addDocuments (Target.java:181)
  at com.google.firestore.v1.Target$DocumentsTarget.a (Target.java:78)
  at com.google.firestore.v1.Target$DocumentsTarget$Builder.addDocuments (Target.java:428)
  at com.google.firebase.firestore.remote.RemoteSerializer.a (RemoteSerializer.java:699)
  at com.google.firebase.firestore.local.LocalSerializer.a (LocalSerializer.java:213)
  at com.google.firebase.firestore.local.SQLiteQueryCache.c (SQLiteQueryCache.java:103)
  at com.google.firebase.firestore.local.SQLiteQueryCache.a (SQLiteQueryCache.java:142)
  at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:530)
  at com.google.firebase.firestore.local.LocalStore$$Lambda$8.run (LocalStore.java:6)
  at com.google.firebase.firestore.local.SQLitePersistence.a (SQLitePersistence.java:180)
  at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:520)
  at com.google.firebase.firestore.core.SyncEngine.a (SyncEngine.java:178)
  at com.google.firebase.firestore.core.EventManager.a (EventManager.java:91)
  at com.google.firebase.firestore.core.FirestoreClient.b (FirestoreClient.java:152)
  at com.google.firebase.firestore.core.FirestoreClient$$Lambda$6.run (FirestoreClient.java:4)
  at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:311)
  at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call (AsyncQueue.java:2)
  at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:287)
  at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run (AsyncQueue.java:4)
  at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:458)
  at java.util.concurrent.FutureTask.run (FutureTask.java:266)
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:301)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run (AsyncQueue.java:205)
  at java.lang.Thread.run (Thread.java:764)

My pubsec.yaml dependencies are:

version: 1.0.0+3

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  shared_preferences: ^0.4.3
  connectivity: ^0.4.3+1
  firebase_auth: ^0.11.1+6
  geolocator: ^5.0.1
  cloud_firestore: ^0.12.11
  flutter_blue: 0.6.2
  intl: ^0.15.8
  random_string: ^0.0.2
  flutter_datetime_picker: ^1.2.4
  permission_handler: ^3.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  font_awesome_flutter: ^8.0.1

I tried updating the cloud_firestore plugin but since I am on the stable channel I cannot upgrade to version 0.13.0+1 since minimum Flutter version required is 1.10.0 and I am on version

Flutter 1.9.1+hotfix.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 68587a0916 (3 months ago) • 2019-09-13 19:46:58 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0

Also, cloud_firestore 0.13.0 gives the following error:

Invalid argument(s): Minimum version ("0.13.0") must be less than maximum ("0.13.0-0").

























package:pub_semver/src/version_range.dart 67:7                          new VersionRange
package:pub/src/solver/reformat_ranges.dart 61:27                       _reformatTerm
package:pub/src/solver/reformat_ranges.dart 39:26                       reformatRanges.<fn>
dart:_internal                                                          ListIterable.toList
package:pub/src/solver/reformat_ranges.dart 40:12                       reformatRanges
package:pub/src/solver/reformat_ranges.dart 34:9                        reformatRanges
package:pub/src/solver/reformat_ranges.dart 33:27                       reformatRanges
package:pub/src/solver/version_solver.dart 308:24                       VersionSolver._resolveConflict
package:pub/src/solver/version_solver.dart 131:27                       VersionSolver._propagate
package:pub/src/solver/version_solver.dart 96:9                         VersionSolver.solve
===== asynchronous gap ===========================
package:pub/src/solver.dart 35:10                                       resolveVersions.<fn>
package:pub/src/log.dart 378:18                                         progress
package:pub/src/solver.dart 32:10                                       resolveVersions
package:pub/src/entrypoint.dart 203:24                                  Entrypoint.acquireDependencies
===== asynchronous gap ===========================
package:pub/src/command/get.dart 41:23                                  GetCommand.run
package:args/command_runner.dart 194:27                                 CommandRunner.runCommand
===== asynchronous gap ===========================
package:pub/src/command_runner.dart 171:39                              PubCommandRunner.runCommand.<fn>
dart:async                                                              new Future.sync
package:pub/src/utils.dart 109:12                                       captureErrors.<fn>
dart:async                                                              runZoned
package:pub/src/utils.dart 126:5                                        captureErrors


package:pub/src/command_runner.dart 171:13                              PubCommandRunner.runCommand
===== asynchronous gap ===========================
package:pub/src/command_runner.dart 119:11                              PubCommandRunner.run
===== asynchronous gap ===========================
/b/s/w/ir/k/src/third_party/dart/third_party/pkg/pub/bin/pub.dart 8:22  main




This is an unexpected error. Please run


    pub --trace '--verbosity=warning' get --no-precompile




and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
pub get failed (1)

Upvotes: 0

Views: 7309

Answers (4)

KUMAR KESHAV
KUMAR KESHAV

Reputation: 23

You can use flutter build apk --no-shrink . It will work. But the recommended method would be to update your flutter sdk and also the dependencies you are using in your pubspec.yaml file.

Upvotes: 0

Thusitha Deepal
Thusitha Deepal

Reputation: 1546

Solve this by

flutter build apk --no-shrink

Upvotes: 4

Sarthak Verma
Sarthak Verma

Reputation: 438

So I solved it by changing to Flutter Master Channel and upgrading to:

Flutter 1.13.1-pre.94 • channel master • https://github.com/flutter/flutter.git
Framework • revision 36e599eb5d (2 days ago) • 2019-12-11 07:27:13 +0100
Engine • revision 12bf95fd49
Tools • Dart 2.7.0 (build 2.7.0-dev.2.1 8b8894648f)

Also, I upgraded the Cloud Firestore to the latest version since I figured out that this was the plugin that was causing the crash.

I then had to upgrade the dependencies from Android > Build.gradle to :

classpath 'com.android.tools.build:gradle:3.3.1'

Also, I upgraded all the plugins in pubsec.yaml to their latest versions and fixed all the breaking changes.

After this, flutter clean and then flutter build apk and everything worked fine.

Upvotes: 0

Can Karabag
Can Karabag

Reputation: 1751

Try to run flutter pub cache repair at command line and sync your gradle files from Android Studio.

You could take Android X error after that. Simply could migrate to Android X if you takes

Migration to Android X: https://flutter.dev/docs/development/androidx-migration

Upvotes: 2

Related Questions