firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.57k stars 3.94k forks source link

🐛 [remote_config] internal remote config fetch error on Google Play Release #11561

Closed Thientran2910 closed 10 months ago

Thientran2910 commented 11 months ago

Bug report

I run the app in debug and release mode in APK and everything works fine. Only when I release the app on Google Play I get an error. App released on ios still works fine Sentry bugs report:

method_channel_firebase_remote_config.dart in MethodChannelFirebaseRemoteConfig.fetchAndActivate at line 150 within firebase_remote_config_platform_interface
Screenshot 2023-09-07 at 19 32 43
Thientran2910 commented 11 months ago
flutter doctor -v ``` [✓] Flutter (Channel stable, 3.13.2, on macOS 13.5.1 22G90 darwin-arm64 (Rosetta), locale en-VN) • Flutter version 3.13.2 on channel stable at /Users/thientv/Workspaces/Flutter/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ff5b5b5fa6 (2 weeks ago), 2023-08-24 08:12:28 -0500 • Engine revision b20183e040 • Dart version 3.1.0 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/thientv/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/thientv/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • 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 • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] VS Code (version 1.81.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.72.0 [✓] Connected device (3 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.5.1 22G90 darwin-arm64 (Rosetta) • Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.179 [✓] Network resources • All expected network resources are available. • No issues found! ```
Thientran2910 commented 11 months ago
dependenceis ``` dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 intl: 0.18.1 json_annotation: ^4.8.1 http: 1.1.0 cached_network_image: 3.2.3 flutter_cache_manager: 3.3.1 transparent_image: ^2.0.0 flutter_multi_formatter: 2.11.7 hive: ^2.2.3 path_provider: 2.1.1 logging: ^1.2.0 hive_flutter: ^1.1.0 source_gen: ^1.2.7 collection: ^1.17.0 money2: 4.0.0 animated_segmented_tab_control: 1.2.0 tab_indicator_styler: ^2.0.0 freezed_annotation: ^2.2.0 dio: 5.3.2 provider: ^6.0.5 expand_tap_area: ^1.1.1 import_sorter: ^4.6.0 dev: ^1.0.0 sticky_headers: ^0.3.0+2 grouped_list: ^5.1.2 sticky_grouped_list: ^3.1.0 modal_bottom_sheet: ^3.0.0-pre web_socket_channel: ^2.3.0 connectivity_plus: 4.0.2 flutter_sticky_header: ^0.6.5 webview_flutter: ^4.2.1 flutter_inappwebview: ^5.7.2+3 popover: ^0.2.8+2 auto_size_text: ^3.0.0 smooth_page_indicator: ^1.0.1 timeago: ^3.3.0 flutter_html: ^3.0.0-beta.1 flutter_secure_storage: 8.1.0 fluttertoast: ^8.2.2 page_transition: ^2.0.9 onesignal_flutter: ^3.5.1 debounce_throttle: ^2.0.0 easy_debounce: ^2.0.3 pull_to_refresh: ^2.0.0 device_info_plus: 9.0.3 stop_watch_timer: 3.0.1 mask_text_input_formatter: 2.5.0 currency_text_input_formatter: ^2.1.10 extended_nested_scroll_view: ^6.1.1 loading_more_list: ^5.0.3 pull_to_refresh_notification: 3.1.0 extended_sliver: ^2.1.3 webview_flutter_android: 3.9.5 webview_flutter_wkwebview: 3.7.4 flutter_flavorizr: 2.2.1 flutter_dotenv: ^5.0.2 flutter_smart_dialog: 4.9.4 package_info_plus: 4.1.0 url_launcher: ^6.1.10 sentry_flutter: 7.9.0 keyboard_actions: ^4.2.0 sign_in_with_apple: 5.0.0 google_sign_in: ^6.1.2 flutter_facebook_auth: 6.0.1 expandable_text: ^2.3.0 syncfusion_flutter_charts: 22.2.11 syncfusion_flutter_sliders: 22.2.11 syncfusion_flutter_core: 22.2.11 syncfusion_flutter_pdfviewer: 22.2.11 syncfusion_flutter_gauges: 22.2.11 expandable: ^5.0.1 flutter_svg: ^2.0.6 vector_graphics: ^1.1.6 flutter_native_splash: 2.3.2 animated_text_kit: ^4.2.2 tuple: ^2.0.1 highlight_text: 1.7.0 scrollable_positioned_list: ^0.3.8 flutter_screenutil: 5.9.0 visibility_detector: 0.4.0+2 pointer_interceptor: ^0.9.3+4 share_plus: 7.1.0 qr_flutter: ^4.1.0 flutter_branch_sdk: 6.7.1 shimmer: ^3.0.0 carousel_slider: ^4.2.1 flutter_keyboard_visibility: ^5.4.1 ensure_visible_when_focused: ^1.1.1 pinput: 3.0.1 hyperkyc_flutter: 0.14.0 animated_toggle_switch: 0.8.0 lottie: 2.6.0 app_settings: 5.0.0 infinite_scroll_pagination: 4.0.0 event_bus_plus: ^0.6.1 firebase_core: 2.15.1 firebase_analytics: 10.4.5 jiffy: ^6.2.1 firebase_performance: 0.9.2+5 screenshot: ^2.1.0 permission_handler: ^10.4.3 firebase_remote_config: ^4.2.5 appsflyer_sdk: ^6.12.2 ```
danagbemava-nc commented 11 months ago

Hi @Thientran2910, please share the full stack trace. In the future, please do not share screenshots of crashes as they are not discoverable.

Thientran2910 commented 11 months ago

@danagbemava-nc

The problem only occurs when I deploy to product on Google Play Store

I get trace logs from Sentry with more then 3000 devices( includes Samsung, Xiaomi decice, Android 13, 12, 11, 10...) has been issue:

FirebaseException: [firebase_remote_config/internal] internal remote config fetch error
  File "message_codecs.dart", line 652, in StandardMethodCodec.decodeEnvelope
  File "platform_channel.dart", line 310, in MethodChannel._invokeMethod
  File "<asynchronous suspension>"
  File "method_channel_firebase_remote_config.dart", line 150, in MethodChannelFirebaseRemoteConfig.fetchAndActivate
  File "<asynchronous suspension>"
  File "firebase_remote_config.dart", line 89, in FirebaseRemoteConfig.fetchAndActivate
  File "<asynchronous suspension>"
  File "remote_config.dart", line 53, in RemoteConfig.fetchAndActivate
  File "<asynchronous suspension>"
  File "remote_config.dart", line 24, in RemoteConfig.init
danagbemava-nc commented 11 months ago

Hi @Thientran2910, can you check the network state of the devices that are experiencing this issue to see whether or not they're running on wifi or mobile data? Also, does this work as expected when you run the app in release mode locally?

bruce-yan commented 11 months ago

same issues

Thientran2910 commented 11 months ago

@danagbemava-nc Release mode locally Working fine, Firebase distribution also working fine. I'm deployed google play and until NOT working. I'm checked at 3 physical devices: 2 samsung + 1 xiaomi all NOT working. Also, similar error messages on sentry appear a lot

Report from Sentry with remote_config: FirebaseException: [firebase_remote_config/internal] internal remote config fetch error File "message_codecs.dart", line 652, in StandardMethodCodec.decodeEnvelope File "platform_channel.dart", line 310, in MethodChannel._invokeMethod File "" File "method_channel_firebase_remote_config.dart", line 150, in MethodChannelFirebaseRemoteConfig.fetchAndActivate File "" File "firebase_remote_config.dart", line 89, in FirebaseRemoteConfig.fetchAndActivate File "" File "remote_config.dart", line 53, in RemoteConfig.fetchAndActivate File "" File "remote_config.dart", line 24, in RemoteConfig.init

danagbemava-nc commented 11 months ago

Hi @Thientran2910, can you check https://stackoverflow.com/a/54603795 to see if it helps?

Thientran2910 commented 11 months ago

@danagbemava-nc I tried but it didn't solve the problem. I searched a lot for solutions in google and stackoverflow. I've tried it all and it doesn't work. I have checked the correct API Service + API key + client ID, all are enabled and correct with google-service.json My application is using sign in with google and it is also working fine. This bug is strange and confusing as it runs fine in local release.

danagbemava-nc commented 11 months ago

Hi @Thientran2910, have you tried reaching out to firebase support to see if they can offer any assistance? The plugin doesn't do anything different in release mode than it does in any other mode. Considering that this only happens when you release the app to playstore, there may be something on the firebase side that may be causing this.

bruce-yan commented 11 months ago

A lot of the following reports appeared in my crashlytics:

report 1

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: [firebase_remote_config/internal] internal remote config fetch error

00 pc 0x56eee7 com.test.example (StandardMethodCodec.decodeEnvelope [message_codecs.dart:652]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

01 pc 0x5eaf0b com.test.example (MethodChannel._invokeMethod [platform_channel.dart:310]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

02 pc 0x5931b3 com.test.example (_SuspendState._createAsyncStarCallback. [async_patch.dart:379]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

03 pc 0x21ccbf com.test.example (_FutureListener.handleValue [zone.dart:1661]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

04 pc 0x59a187 com.test.example (Future._propagateToListeners.handleValueCallback [future_impl.dart:840]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

05 pc 0x21b9e3 com.test.example (Future._propagateToListeners [future_impl.dart:869]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

06 pc 0x21b527 com.test.example (Future._completeWithValue [future_impl.dart:641]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

07 pc 0x21b493 com.test.example (Future._asyncCompleteWithValue. [future_impl.dart:715]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

08 pc 0x21b123 com.test.example (_microtaskLoop [schedule_microtask.dart:40]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

09 pc 0x5994c3 com.test.example (_startMicrotaskLoop [schedule_microtask.dart:49]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

10 pc 0x21b093 com.test.example (_startMicrotaskLoop [schedule_microtask.dart:44]) (BuildId: 5640f66f9c22027f4067e263e4177e5e)

report 2

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(firebase_remote_config, Unable to connect to the server. Check your connection and try again., null, null)

00 pc 0x68bde3 com.test.example (FirebaseCrashlytics.recordError [firebase_crashlytics.dart:119]) (BuildId: 37794ab951518c9ea101056aff89df3e)

01 pc 0x5f71a7 com.test.example (main. [main.dart:91]) (BuildId: 37794ab951518c9ea101056aff89df3e)

02 pc 0x63c7d7 com.test.example (PlatformDispatcher._dispatchError [platform_dispatcher.dart:1248]) (BuildId: 37794ab951518c9ea101056aff89df3e)

03 pc 0x28b3e3 com.test.example (_onError [hooks.dart:145]) (BuildId: 37794ab951518c9ea101056aff89df3e)

04 pc 0x28b413 com.test.example (_onError [hooks.dart:143]) (BuildId: 37794ab951518c9ea101056aff89df3e)

Thientran2910 commented 11 months ago

@danagbemava-nc I asked firebase support. Waiting reply.

mjurfest commented 11 months ago

I have the same issue @Thientran2910. While debugging I tried this (instead of just calling fetchAndActivate) and it worked but it's a bad solution.

await remoteConfig.activate();
await Future.delayed(const Duration(seconds: 1));
await remoteConfig.fetchAndActivate();

Looking forward for a fix from Firebase.

google-oss-bot commented 10 months ago

Hey @Thientran2910. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 10 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@Thientran2910 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

omar-khaium commented 10 months ago

Still same issue on android. iOS is working fine.

VeskoDev commented 9 months ago

Hello there, I have the same issue on Android, iOS is working without any problem