Muhtar
Muhtar

Reputation: 1700

Flutter release app Firestore fatal exception

Hi there I have an issue with my app on release mode that I could not resolve for a week. Everything is fine in debug mode when I type flutter run --release I got this error. What can be the issue? Generated sha1 and sha256 keys and applied to the firebase. Could be because of internet permission? But it initialize firebase, i am really stuck right now. I got the same error when I generated release apk from mac.

flutter doctor - v

    C:\Users\Alperen\AndroidStudioProjects\hilmiguneruygulmasi>flutter doctor -v
[√] Flutter (Channel master, 2.3.0-17.0.pre.372, on Microsoft Windows [Version 10.0.19042.1052], locale tr-TR)
    • Flutter version 2.3.0-17.0.pre.372 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a2336e9ac7 (24 hours ago), 2021-06-15 14:59:04 -0400
    • Engine revision e0011fa561
    • Dart version 2.14.0 (build 2.14.0-211.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 51.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Community Edition (version 2020.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (1 available)
    • SM G780F (mobile) • RF8NA01VXSL • android-arm64 • Android 11 (API 30)

 Running "flutter pub get" in              1.349ms
    Launching lib\main.dart on SM G780F in release mode...
    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\advance_pdf_viewer-2.0.0\android\src\main\java\pt\tribeiro\flutter_plugin_pdf_viewer\FlutterPluginPdfViewerPlugin.java uses or ove
    rrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.3.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a depr
    ecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-2.2.2\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java uses or over
    rides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-2.2.2\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses
     unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_storage-8.1.3\android\src\main\java\io\flutter\plugins\firebase\storage\FlutterFirebaseStoragePlugin.java:38: warning: [depreca
    tion] Registrar in PluginRegistry has been deprecated
      public static void registerWith(PluginRegistry.Registrar registrar) {
                                                    ^
    1 warning
    Running Gradle task 'assembleRelease'...                          124,6s
    √  Built build\app\outputs\flutter-apk\app-release.apk (8.0MB).
    Installing build\app\outputs\flutter-apk\app.apk...                 8,5s
    
    Flutter run key commands.
    h List all available interactive commands.
    c Clear the screen
    q Quit (terminate the application on the device).
    E/AndroidRuntime(18581): FATAL EXCEPTION: main
    E/AndroidRuntime(18581): Process: com.yol.hilmiguneruygulmasi, PID: 18581
    E/AndroidRuntime(18581): java.lang.RuntimeException: Internal error in Cloud Firestore (23.0.1).
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.u.m(Unknown Source:19)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.f.run(Unknown Source:2)
    E/AndroidRuntime(18581):        at android.os.Handler.handleCallback(Handler.java:938)
    E/AndroidRuntime(18581):        at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(18581):        at android.os.Looper.loop(Looper.java:246)
    E/AndroidRuntime(18581):        at android.app.ActivityThread.main(ActivityThread.java:8506)
    E/AndroidRuntime(18581):        at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(18581):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    E/AndroidRuntime(18581):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
    E/AndroidRuntime(18581): Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Failed to gain exclusive lock to the Cloud Firestore client's offline persistence. This genera
    lly means you are using Cloud Firestore from multiple processes in your app. Keep in mind that multi-process Android apps execute the code in your Application class in all processes, so
    you may need to avoid initializing Cloud Firestore in your Application class. If you are intentionally using Cloud Firestore from multiple processes, you can only enable offline persiste
    nce (that is, call setPersistenceEnabled(true)) in one of them.
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.s.i(Unknown Source:14)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.d.run(Unknown Source:4)
    E/AndroidRuntime(18581):        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
    E/AndroidRuntime(18581):        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    E/AndroidRuntime(18581):        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    E/AndroidRuntime(18581):        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    E/AndroidRuntime(18581):        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.r.run(Unknown Source:15)
    E/AndroidRuntime(18581):        at java.lang.Thread.run(Thread.java:923)
    E/AndroidRuntime(18581): Caused by: java.lang.RuntimeException: Failed to gain exclusive lock to the Cloud Firestore client's offline persistence. This generally means you are using Clou
    d Firestore from multiple processes in your app. Keep in mind that multi-process Android apps execute the code in your Application class in all processes, so you may need to avoid initia
    lizing Cloud Firestore in your Application class. If you are intentionally using Cloud Firestore from multiple processes, you can only enable offline persistence (that is, call setPersis
    tenceEnabled(true)) in one of them.
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.q0.e1.k(Unknown Source:44)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.p0.i0.i(:1)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.p0.X.g(Unknown Source:65)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.p0.X.r(Unknown Source:10)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.p0.s.run(Unknown Source:8)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.b.call(lambda:1)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.u0.s.i(Unknown Source:0)
    E/AndroidRuntime(18581):        ... 8 more
    E/AndroidRuntime(18581): Caused by: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY[5]): , while compiling: PRAGMA journal_mode
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1463)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:1050)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:606)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:542)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:378)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:980)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:444)
    E/AndroidRuntime(18581):        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:387)
    E/AndroidRuntime(18581):        at com.google.firebase.firestore.q0.e1.k(Unknown Source:16)
    E/AndroidRuntime(18581):        ... 14 more

Upvotes: 1

Views: 1067

Answers (1)

Open Android Studio -> file -> settings->Appearance & behavior -> system setting - > Android SDK . Choose SDK Tools and look for Android SDK command-line tools(latest). Select it and install updates if there are any. Click the apply button below to install.

open the cmd and run 'flutter doctor'.

Upvotes: 1

Related Questions