Skip to content

Flutter templates should support "com.android.library" Gradle plugin #11632

Open

Description

@postmasters

The generated plugin template build.gradle files, and Flutter's packages/flutter_tools/gradle/flutter.gradle do not support Android library.

In the flutter.gradle file, only project.android.applicationVariants are used. Android library does not have this property and instead offers libraryVariants.

The problem does not happen to app template, such as the example/android in the plugin package.

Fixing this would eliminate all the squiggle lines and missing Flutter imports in Java source.

This is probably related to #11439 and #9698.

Activity

  1. mit-mit commented on Aug 16, 2017

    @mit-mit
    Member
  2. mravn-google commented on Aug 16, 2017

    @mravn-google
    Contributor

    @postmasters The flutter.gradle script is only intended for building apps. Its role in a plugin project is to build the example app, and thereby to ensure that flutter.jar is available as a provided dependency of the plugin library.

    To avoid the squiggle lines in Android Studio, you should import the build.gradle file in the example app (/example/android/build.gradle) rather than opening the /android library directly.

    Please let us know if that does not work for you.

  3. postmasters commented on Aug 18, 2017

    @postmasters
    ContributorAuthor

    That works but isn't a very intuitive user experience. Why would one want to open an example app to work on the plugin code? Each module should be self contained. It is weird that in order to compile the Android library code, I need to create an app.

  4. added
    platform-androidAndroid applications specifically
    t: gradle"flutter build" and "flutter run" on Android
    on May 9, 2018
  5. added this to the milestone on May 9, 2018
  6. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    p: toolingAffects the flutter_plugin_tools package
    on Jan 21, 2019
  7. tolotrasamuel commented on Mar 19, 2019

    @tolotrasamuel

    How would the change on example will be applied on the actual plugin ?

  8. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  9. removed this from the milestone on Aug 17, 2020
  10. added
    a: pluginsSupport for writing, building, and running plugin packages
    on Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: pluginsSupport for writing, building, and running plugin packagesplatform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions