Tuesday, March 19, 2024
HomeiOS Developmentandroid - Flutter Firebase does work on my principal setup however not...

android – Flutter Firebase does work on my principal setup however not on my second though its the identical app


I exploit two completely different Programs for coding. At dwelling, I’ve an iMac and whereas I’m touring or on enterprise journeys I’ve a Home windows laptop computer. When working from dwelling, I haven’t got any issues working and creating my flutter app on each, iOS and Android.

Nevertheless, when I’m touring I exploit my Home windows Laptop computer I get bizarre errors from Firebase and my App appears to not like Firebase. I exploit Firebase Distant Config and Firebase Cloud Messaging.

When working my Android app on my Home windows Laptop computer and attempt to get an FCM token, I get the next error:

E/FirebaseInstanceId( 4181): Did not get FIS auth token
E/FirebaseInstanceId( 4181): java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please attempt once more later.
E/FirebaseInstanceId( 4181):  at com.google.android.gms.duties.Duties.zza(com.google.android.gms:play-services-tasks@@18.0.2:5)
E/FirebaseInstanceId( 4181):  at com.google.android.gms.duties.Duties.await(com.google.android.gms:play-services-tasks@@18.0.2:8)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.GmsRpc.setDefaultAttributesToBundle(com.google.firebase:firebase-iid@@21.1.0:11)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.GmsRpc.startRpc(com.google.firebase:firebase-iid@@21.1.0:1)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.GmsRpc.getToken(com.google.firebase:firebase-iid@@21.1.0:1)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.FirebaseInstanceId.lambda$getInstanceId$2$FirebaseInstanceId(com.google.firebase:firebase-iid@@21.1.0:1)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.FirebaseInstanceId$$Lambda$3.begin(Unknown Supply:10)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.RequestDeduplicator.getOrStartGetTokenRequest(com.google.firebase:firebase-iid@@21.1.0:7)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.FirebaseInstanceId.lambda$getInstanceId$3$FirebaseInstanceId(com.google.firebase:firebase-iid@@21.1.0:5)
E/FirebaseInstanceId( 4181):  at com.google.firebase.iid.FirebaseInstanceId$$Lambda$0.then(Unknown Supply:6)
E/FirebaseInstanceId( 4181):  at com.google.android.gms.duties.zze.run(com.google.android.gms:play-services-tasks@@18.0.2:1)
E/FirebaseInstanceId( 4181):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/FirebaseInstanceId( 4181):  at java.util.concurrent.ThreadPoolExecutor$Employee.run(ThreadPoolExecutor.java:637)
E/FirebaseInstanceId( 4181):  at com.google.android.gms.frequent.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.2.0:2)
E/FirebaseInstanceId( 4181):  at java.lang.Thread.run(Thread.java:1012)
E/FirebaseInstanceId( 4181): Brought on by: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please attempt once more later.
E/FirebaseInstanceId( 4181):  at com.google.firebase.installations.distant.FirebaseInstallationServiceClient.createFirebaseInstallation(FirebaseInstallationServiceClient.java:153)
E/FirebaseInstanceId( 4181):  at com.google.firebase.installations.FirebaseInstallations.registerFidWithServer(FirebaseInstallations.java:533)
E/FirebaseInstanceId( 4181):  at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:387)
E/FirebaseInstanceId( 4181):  at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$3$com-google-firebase-installations-FirebaseInstallations(FirebaseInstallations.java:372)
E/FirebaseInstanceId( 4181):  at com.google.firebase.installations.FirebaseInstallations$$ExternalSyntheticLambda0.run(Unknown Supply:4)
E/FirebaseInstanceId( 4181):  at com.google.firebase.concurrent.SequentialExecutor$1.run(SequentialExecutor.java:117)
E/FirebaseInstanceId( 4181):  at com.google.firebase.concurrent.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:229)
E/FirebaseInstanceId( 4181):  at com.google.firebase.concurrent.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:174)
E/FirebaseInstanceId( 4181):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/FirebaseInstanceId( 4181):  at java.util.concurrent.ThreadPoolExecutor$Employee.run(ThreadPoolExecutor.java:637)
E/FirebaseInstanceId( 4181):  at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
E/FirebaseInstanceId( 4181):  at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(Unknown Supply:4)

And that is the error I get for Firebase Distant config (additionally Android/Home windows setup):

E/flutter ( 4181): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_remote_config/internal] inner distant config fetch error
E/flutter ( 4181): #0      StandardMethodCodec.decodeEnvelope (bundle:flutter/src/providers/message_codecs.dart:651:7)
E/flutter ( 4181): #1      MethodChannel._invokeMethod (bundle:flutter/src/providers/platform_channel.dart:334:18)
E/flutter ( 4181): <asynchronous suspension>
E/flutter ( 4181): #2      MethodChannelFirebaseRemoteConfig.fetchAndActivate (bundle:firebase_remote_config_platform_interface/src/method_channel/method_channel_firebase_remote_config.dart:150:29)
E/flutter ( 4181): <asynchronous suspension>
E/flutter ( 4181): #3      FirebaseRemoteConfig.fetchAndActivate (bundle:firebase_remote_config/src/firebase_remote_config.dart:89:26)
E/flutter ( 4181): <asynchronous suspension>
E/flutter ( 4181): #4      BootService.initFirebase (bundle:myapp_app/providers/boot_service.dart:32:5)
E/flutter ( 4181): <asynchronous suspension>
E/flutter ( 4181): #5      principal (bundle:myapp_app/principal.dart:16:3)
E/flutter ( 4181): <asynchronous suspension>

I additionally do have an outdated MacBook and tried to get my app to run on iOS to check whether or not it’s a Home windows/setup drawback or if I can re-create the issue. There I get a completely different drawback:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_remote_config/internal] Did not get installations token. Error : Error Area=com.firebase.installations Code=2 "Too many server requests." UserInfo={NSLocalizedFailureReason=Too many server requests.}.

When attempting to print the FCM token with an Android gadget on my Mac I get the identical error as on my Home windows laptop computer with an Android gadget (see above).

That is my principal.dart:

void principal() async {
  WidgetsFlutterBinding.ensureInitialized();

  await BootService.initFirebase();
  ...
  ... 
  ...

 runApp(...)
}

And that is my boot_service.dart file:

class BootService {
  static initFirebase() async {
    await Firebase.initializeApp(
      choices: DefaultFirebaseOptions.currentPlatform,
    );

    /// Distant Config
    closing remoteConfig = FirebaseRemoteConfig.occasion;
    await remoteConfig.setConfigSettings(RemoteConfigSettings(
      fetchTimeout: const Period(minutes: 1),
      minimumFetchInterval: const Period(hours: 1),
    ));
    
    await remoteConfig.setDefaults(ConfigFirebaseRemote.keyValuePairs);
    
    await remoteConfig.fetchAndActivate();
  }

  ...
  ...
  ...
}

I nonetheless do not perceive how it’s potential that on my principal setup (iMac) I can run each, Android and iOS with out getting any errors… My google-services.json in addition to my GoogleService-Information.plist are all right set.

Impressed by this Stack reply, I additionally examined if my configuration works with the next CURL command. And yeah, it does work. I do not get any error. It efficiently authenticates.

api_key=<YOUR_API_KEY>
project_identifier=<YOUR_PROJECT_ID>
app_id=<YOUR_FIREBASE_APP_ID_EXAMPLE_1:12345678:android:00000aaaaaaaa>

curl -H "content-type: software/json" -d "{appId: '$app_id', sdkVersion: 't:1'}" https://firebaseinstallations.googleapis.com/v1/tasks/$project_identifier/installations/?key=$api_key

My packages.yaml file:

atmosphere:
  sdk: '>=3.3.1 <4.0.0'

firebase_messaging: ^14.7.20
firebase_core: ^2.27.1
firebase_remote_config: ^4.3.18

Listed here are my flutter physician -v prints for all three of my machines.
Foremost Setup (iMac):

[✓] Flutter (Channel steady, 3.19.3, on macOS 14.4 23E214 darwin-arm64, locale de-DE)
    • Flutter model 3.19.3 on channel steady at /choose/homebrew/Caskroom/flutter/3.13.9/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba39319843 (10 days in the past), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart model 3.3.1
    • DevTools model 2.31.1

[✓] Android toolchain - develop for Android units (Android SDK model 34.0.0)
    • Android SDK at /Customers/jantrier/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Functions/Android Studio.app/Contents/jbr/Contents/Residence/bin/java
    • Java model OpenJDK Runtime Setting (construct 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Functions/Xcode.app/Contents/Developer
    • Construct 15E204a
    • CocoaPods model 1.15.2

[✓] Chrome - develop for the online
    • Chrome at /Functions/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (model 2022.2)
    • Android Studio at /Functions/Android Studio.app/Contents
    • Flutter plugin might be put in from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin might be put in from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java model OpenJDK Runtime Setting (construct 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Final Version (model 2023.2.5)
    • IntelliJ at /Functions/IntelliJ IDEA.app
    • Flutter plugin model 77.1.3
    • Dart plugin model 232.10286

[✓] VS Code (model 1.87.1)
    • VS Code at /Functions/Visible Studio Code.app/Contents
    • Flutter extension might be put in from:
      🔨 https://market.visualstudio.com/gadgets?itemName=Dart-Code.flutter

[✓] Related gadget (2 out there)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.4 23E214 darwin-arm64
    • Chrome (net)    • chrome • web-javascript • Google Chrome 122.0.6261.129

[✓] Community assets
    • All anticipated community assets can be found.

Second Setup (Home windows):

[√] Flutter (Channel steady, 3.19.3, on Microsoft Home windows [Version 10.0.19045.4170], locale de-DE)
    • Flutter model 3.19.3 on channel steady at C:UsersUserDesktopflutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba39319843 (11 days in the past), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart model 3.3.1
    • DevTools model 2.31.1

[√] Home windows Model (Put in model of Home windows is model 10 or larger)

[√] Android toolchain - develop for Android units (Android SDK model 33.0.1)
    • Android SDK at C:UsersUserAppDataLocalAndroidsdk
    • Platform android-34, build-tools 33.0.1
    • Java binary at: C:Program FilesJavajdk-11.0.17binjava
    • Java model Java(TM) SE Runtime Setting 18.9 (construct 11.0.17+10-LTS-269)
    • All Android licenses accepted.

[√] Chrome - develop for the online
    • Chrome at C:Program FilesGoogleChromeApplicationchrome.exe

[X] Visible Studio - develop Home windows apps
    X Visible Studio not put in; that is essential to develop Home windows apps.
      Obtain at https://visualstudio.microsoft.com/downloads/.
      Please set up the "Desktop improvement with C++" workload, together with all of its default elements

[√] Android Studio (model 2023.2)
    • Android Studio at C:Program FilesAndroidAndroid Studio1
    • Flutter plugin might be put in from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin might be put in from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java model OpenJDK Runtime Setting (construct 17.0.9+0--11185874)

[√] Community assets
    • All anticipated community assets can be found.

My outdated MacBook:

[✓] Flutter (Channel steady, 3.19.3, on macOS 14.2.1 23C71 darwin-arm64, locale en-DE)
    • Flutter model 3.19.3 on channel steady at /Customers/consumer/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba39319843 (11 days in the past), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart model 3.3.1
    • DevTools model 2.31.1

[✓] Android toolchain - develop for Android units (Android SDK model 33.0.2)
    • Android SDK at /Customers/consumer/Library/Android/sdk
    • Platform android-34, build-tools 33.0.2
    • Java binary at: /Functions/Android Studio.app/Contents/jbr/Contents/Residence/bin/java
    • Java model OpenJDK Runtime Setting (construct 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Functions/Xcode.app/Contents/Developer
    • Construct 15C500b
    • CocoaPods model 1.14.3

[✓] Chrome - develop for the online
    • Chrome at /Functions/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (model 2023.1)
    • Android Studio at /Functions/Android Studio.app/Contents
    • Flutter plugin might be put in from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin might be put in from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java model OpenJDK Runtime Setting (construct 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (model 1.87.2)
    • VS Code at /Customers/consumer/Desktop/setups/Visible Studio Code.app/Contents
    • Flutter extension model 3.84.0

[✓] Related gadget (2 out there)
    • macOS (desktop)           • macos         • darwin-arm64   • macOS 14.2.1 23C71 darwin-arm64
    • Chrome (net)              • chrome        • web-javascript • Google Chrome 122.0.6261.129

[✓] Community assets
    • All anticipated community assets can be found.

I’ve additionally tried to repair my Firebase Distant Config drawback with the 2 following points, however they didn’t work:

  1. https://github.com/firebase/flutterfire/points/6196#issuecomment-887399471
  2. https://github.com/firebase/flutterfire/points/6196#issuecomment-927751667

As talked about from different customers I additionally tried to arrange a HotSpot and verify date and time on my emulator. However these fixes additionally did not resolve my drawback…

I actually do not know what to do or attempt subsequent to repair my drawback. I can not discover some other Stack or GitHub problem which has faces the identical or an analogous problem. Probably the most complicated half is that I’ve different apps which work very nicely with Firebase on my Home windows Laptop computer and the app and Firebase is engaged on my principal setup..

I admire any form of assist!



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments