Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@blasten
Copy link

@blasten blasten commented Mar 30, 2021

Fixes flutter/flutter#78625

I reported this bug to the R8 team as there was some recent work in this area.

Currently, importing ImagePickerPlugin causes the outer method code to be removed:

    flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin());
    // (removed) flutterEngine.getPlugins().add(new io.flutter.plugins.packageinfo.PackageInfoPlugin());
    // (removed) flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());

Changing the APIs consumed in ImagePickerPlugin causes different R8 optimizations. Particularly, the onDestroy method seems suspicious. https://gist.github.com/blasten/aad37e8173f6c52cc7c0d4ce403aa1e2.

For testing this, we would need an e2e test that builds release, and calls the methods in the channel. Unfortunately, these type of e2e tests typically live in the framework, so it would need to be defined there.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@blasten
Copy link
Author

blasten commented Mar 30, 2021

#3746 is a better fix. I'm closing this for now. One thing that was weird is that I would have expected the app to crash in this situation.

@blasten blasten closed this Mar 30, 2021
@blasten blasten deleted the image_picker_r8_bug branch March 30, 2021 01:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some plugins breaks on release mode on Android

1 participant