-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/plugins
#1812Labels
c: regressionIt was better in the past than it is nowIt was better in the past than it is nowcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: firebase_databaseThe Firebase Database pluginThe Firebase Database pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Milestone
Description
Steps to Reproduce
Just do Transaction like :
final dataRef = database.reference().child('path/to/data');
dataRef.runTransaction((MutableData transaction) async{
transaction.value = (transaction.value ?? 0) + 1;
return transaction;
});
error
java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: FirebaseDatabaseWorker
affected/tested branches with this issue:
- v1.6.6
- v1.7.2 ([firebase_database] Transaction crashing on v1.5.8+ with Error (Methods marked with @UiThread must be executed on the main thread) #33562 (comment))
- v1.7.5
- v1.7.9 ([firebase_database] Transaction crashing on v1.5.8+ with Error (Methods marked with @UiThread must be executed on the main thread) #33562 (comment)) & ([firebase_database] Transaction crashing on v1.5.8+ with Error (Methods marked with @UiThread must be executed on the main thread) #33562 (comment))
known to work as expected with:
- stable branch (v1.5.4-hotfix.2)
- v1.5.8
plugin version affected with this
well, i think it's a problem with the SDK itself not the plugin, but tested with
- firebase_database: ^3.0.3 ([firebase_database] Transaction crashing on v1.5.8+ with Error (Methods marked with @UiThread must be executed on the main thread) #33562 (comment))
related with this error
correct me if i'm wrong to remove any of them
- Cause crash in FlutterJNI if invoked on non-main thread in debug mode (#31263). engine#8830
- [cloud_firestore] Invoke on ui thread only plugins#1701
- Android Firebase RTDB Transactions integration test failure #34422
- Regression in cloud_firestore and firebase_database Android Transactions #32657
- Plugins crash with "Methods marked with @UiThread must be executed on the main thread." #34993
useful references
- StackOverflow Issue #56209091 asked May 19 at 15:06 confirms that it's working on v1.5.8
Crash Log
E/RepoOperation( 5654): Caught Throwable.
E/RepoOperation( 5654): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: FirebaseDatabaseWorker
E/RepoOperation( 5654): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:605)
E/RepoOperation( 5654): at io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:515)
E/RepoOperation( 5654): at io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:76)
E/RepoOperation( 5654): at io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:166)
E/RepoOperation( 5654): at io.flutter.view.FlutterNativeView.send(FlutterNativeView.java:155)
E/RepoOperation( 5654): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:98)
E/RepoOperation( 5654): at io.flutter.plugins.firebase.database.FirebaseDatabasePlugin$1.doTransaction(FirebaseDatabasePlugin.java:345)
E/RepoOperation( 5654): at com.google.firebase.database.core.Repo.startTransaction(com.google.firebase:firebase-database@@17.0.0:831)
E/RepoOperation( 5654): at com.google.firebase.database.DatabaseReference$4.run(com.google.firebase:firebase-database@@17.0.0:511)
E/RepoOperation( 5654): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
E/RepoOperation( 5654): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/RepoOperation( 5654): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
E/RepoOperation( 5654): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/RepoOperation( 5654): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/RepoOperation( 5654): at java.lang.Thread.run(Thread.java:764)
another one is at : (#33562 (comment))
Flutter Doctor -v
flutter doctor -v
[√] Flutter (Channel dev, v1.6.6, on Microsoft Windows [Version 10.0.17763.437], locale en-US)
• Flutter version 1.6.6 at E:\flutter
• Framework revision e1a784ae3f (28 hours ago), 2019-05-28 21:53:03 -0700
• Engine revision 8dc3a4cde2
• Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\eslam\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2018.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.5
• Flutter plugin version 31.3.3
• Dart plugin version 182.5215
[!] VS Code (version 1.28.0)
• VS Code at C:\Users\eslam\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (2 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Windows • Windows • windows-x64 • Microsoft Windows [Version 10.0.17763.437]
! Doctor found issues in 1 category.
another one is at (#33562 (comment))
experiencing the same issue ?!
"me too" and "+1" comments are pointless.
so just comment if you're going to add new info/logs or tested on new branch/version.
otherwise use
on the initial comment (this) to up-vote and increase priority.
Comments cause spammy notification mails sent to all subscribers.
If you want to get notified, use 
VyMajoris, jorgevvr, lukepighetti, bsivanantham, jpeiffer and 6 more
Metadata
Metadata
Assignees
Labels
c: regressionIt was better in the past than it is nowIt was better in the past than it is nowcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: firebase_databaseThe Firebase Database pluginThe Firebase Database pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.