9

Everything works perfectly when in debug mode. It first happened when I update Flutter version to 1.10.x I could not remember which version did I use, properly. It should be 1.7.8, it was stable. To fix it I downgrade the flutter to 1.7.8+4 and also downgrade firebase related pub packages. But error still here.

Stack Trace for Related Error, captured from gogle 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:790)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:7000)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.AbstractMethodError: 
  at com.google.protobuf.GeneratedMessageLite.a (GeneratedMessageLite.java:1319)
  at com.google.firebase.firestore.proto.WriteBatch.s (WriteBatch.java:120)
  at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:162)
  at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:15)
  at com.google.firebase.firestore.proto.WriteBatch$Builder.a (WriteBatch.java:835)
  at com.google.firebase.firestore.local.LocalSerializer.a (LocalSerializer.java:172)
  at com.google.firebase.firestore.local.SQLiteMutationQueue.a (SQLiteMutationQueue.java:188)
  at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:237)
  at com.google.firebase.firestore.local.LocalStore$$Lambda$2.get (LocalStore.java:8)
  at com.google.firebase.firestore.local.SQLitePersistence.a (SQLitePersistence.java:195)
  at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:201)
  at com.google.firebase.firestore.core.SyncEngine.a (SyncEngine.java:227)
  at com.google.firebase.firestore.core.FirestoreClient.a (FirestoreClient.java:200)
  at com.google.firebase.firestore.core.FirestoreClient$$Lambda$11.run (FirestoreClient.java:6)
  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:457)
  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:1162)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)
  at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run (AsyncQueue.java:205)
  at java.lang.Thread.run (Thread.java:764)

When I saw the error trace on device (in android crash report dialog) It mentioned Firebase 19.0.0

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17134.1069], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2017 15.9.7)
[√] Android Studio (version 3.4)
[√] VS Code, 64-bit edition (version 1.38.1)
[√] Connected device (3 available)

• No issues found!

Error reporoducing scenario for final describe:

  • Build app with flutter run --release
  • App try an basic firestore call

    Firestore.instance.collection('collection-name').document('docuemnt-id').get()

  • App crashes.

Also getting the same error with building with flutter build appbudle

6 Answers 6

6

Here is the solution of my nightmare.

EDIT:

Error

FATAL EXCEPTION: main
Process: com.app.android, PID: 12668
java.lang.RuntimeException: Internal error in Firestore (19.0.0).
    at com.google.firebase.firestore.g.j.a(:379)
    at com.google.firebase.firestore.g.g.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

To fix this error, update android.enableR8=false in gradle.properties. You need to add this row cause default value true.

Sign up to request clarification or add additional context in comments.

1 Comment

Finally!!! Thank you so much! I wasted a lot of time trying to fix this and would be stuck for some more time if I didn't find your solution.
3

I was facing the same problem, and the following changes to my build.gradle solved it.

android {
    compileSdkVersion 28

    ... 
    buildTypes {
        release {
            shrinkResources false
            minifyEnabled false
            signingConfig signingConfigs.release
            
        }
    }
}

Reference: https://github.com/FirebaseExtended/flutterfire/issues/1412#issuecomment-570161645

N.B. I know its not a perfect solution to disable minify. But it seems the firebase team is working on it and will be resolved in future update

1 Comment

this solved my problem, is related to this question - stackoverflow.com/questions/69094856/…
1

I was able to keep android.enableR8=true by upgrading the gradle version.

android/build.gradle

from:

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

to:

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

android/gradle/wrapper/gradle-wrapper.properties

from:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

to:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

Comments

0

I have a similar case (same error), so I'll try to tell you what happened and maybe is the same issue that you have.

In my case I lost the keystore, so I pass through all the process of ask for a new key and so on, after that I publish a new version and my app crash in the exact way of yours, after a lot of google and stuff I figured out that have something to do with the signature (because works in debug but do not work in release), so I get into the firebase console and download again the google-services.json file, and surprise... the file have a block that wasn't there before.

After that, I test in a device with the command that you provide here (by the way thanks!), and woala! It works.

I also update the SHA-1 Signature key in the console, so that may help too. I hope that my response help you to come out to some solution.

Comments

0

https://github.com/flutter/flutter/issues/41576

changing to version 3.4.2 i.e com.android.tools.build:gradle:3.4.2 in build.gradle(project) , worked for me.

Comments

0

In case you don't want to disable R8 minification, add these rules to your proguard-rules.pro:

-keep class com.google.firestore.** { *; }
-keep class io.grpc.** { *; }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.