Skip to content

🐛 [firebase_remote_config] Android error: FormatException: Invalid envelope #5958

@Sthefanny

Description

@Sthefanny

Bug report

After change firebase_remote_config from version 0.4.2 to 0.10.0-dev.0, iOS version is working fine, but on Android I'm getting FormatException: Invalid envelope

Steps to reproduce

late RemoteConfig _remoteConfig;

RemoteConfigService._init() {
  _init();
}

void _init() async {
    _remoteConfig = RemoteConfig.instance;
    final defaults = <String, dynamic>{
      'test': '',
    };
    await _remoteConfig.setConfigSettings(RemoteConfigSettings(fetchTimeout: Duration(seconds: 10), minimumFetchInterval: Duration.zero));
    await _remoteConfig.setDefaults(defaults);
    await _refresh();
    Timer(Duration(hours: 12, minutes: 1), () => _refresh());
  }

Future<void> _refresh() async {
    try {
      await _remoteConfig.ensureInitialized();
      await _remoteConfig.fetchAndActivate();
      print('welcome message: ' + _remoteConfig.getString('test'));
    } on PlatformException catch (exception) {
      // Fetch exception.
      print(exception);
    } catch (exception) {
      print('Unable to fetch remote config. Cached or default values will be used');
      print(exception);
    }
}

Executing this on Android will go to the catch (exception) with the specified error.

Expected behavior

Should return variable value added in the remoteConfig


Additional context

Works fine on iOS


Flutter doctor

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.4, on macOS 11.2.2 20D80 darwin-x64, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.55.2)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
PASTE OUTPUT INSIDE HERE

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions