-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/plugins
#148Labels
p: toolingAffects the flutter_plugin_tools packageAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specifically
Milestone
Description
Some plugins (right now, google_sign_in) require that your main app activity be an instance of android.support.v4.app.FragmentActivity. Right now, Flutter makes this possible, but not as easy as it could be. The current state is:
- Flutter provides
io.flutter.app.FlutterFragmentActivityout of the box, but it doesn't bundle theandroid-support-v4library, upon which that activity depends at runtime (it omits this library on purpose to avoid bloating application binaries that don't need to useFlutterFragmentActivity). - The plugin's Gradle dependency pulls in the requisite
android-support-v4library so that the necessary classes are available at runtime. - The plugin throws a runtime exception if it detects that your app's activity isn't an instance of
FragmentActivity. The exception message directs the user towardsFlutterFragmentActivity. - The developer has to manually edit their
MainActivityto extend fromFlutterFragmentActivityrather than fromFlutterActivityin order to get back up and running.
While the good news is that we support the use case of plugins that require FragmentActivity, the developer experience leaves something to be desired. Notably, the developer under normal circumstances doesn't need to hand edit anything in MainActivity - the auto-plugin-registration takes care of any would-be edits. So telling them to go hand-edit the activity is a break from the developer experience they've come to expect.
branflake2267 and Solido
Metadata
Metadata
Assignees
Labels
p: toolingAffects the flutter_plugin_tools packageAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specifically